ember-storybook 0.1.2 → 0.1.3
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/declarations/client/docs/preview-patch.d.ts +7 -0
- package/declarations/client/docs/preview-patch.d.ts.map +1 -0
- package/declarations/client/docs/renderer.d.ts +8 -0
- package/declarations/client/docs/renderer.d.ts.map +1 -0
- package/declarations/client/render.d.ts.map +1 -1
- package/declarations/client/types.d.ts +3 -0
- package/declarations/client/types.d.ts.map +1 -1
- package/declarations/preset.d.ts.map +1 -1
- package/dist/client/config.mjs +1 -1
- package/dist/client/docs/preview-patch.mjs +15 -0
- package/dist/client/docs/preview-patch.mjs.map +1 -0
- package/dist/client/docs/renderer.mjs +48 -0
- package/dist/client/docs/renderer.mjs.map +1 -0
- package/dist/client/index.mjs +2 -2
- package/dist/{client-Cn86nY-K.mjs → client-CjnOdn6v.mjs} +2 -2
- package/dist/{client-Cn86nY-K.mjs.map → client-CjnOdn6v.mjs.map} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/preset.mjs +11 -1
- package/dist/preset.mjs.map +1 -1
- package/dist/react-BcVz11Jd.mjs +64 -0
- package/dist/react-BcVz11Jd.mjs.map +1 -0
- package/dist/{render-UnP87BCQ.mjs → render-B0rRnyCZ.mjs} +48 -10
- package/dist/render-B0rRnyCZ.mjs.map +1 -0
- package/package.json +7 -1
- package/dist/render-UnP87BCQ.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-patch.d.ts","sourceRoot":"","sources":["../../../src/client/docs/preview-patch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAY1C,eAAO,MAAM,UAAU;;;;CAMtB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DocsContextProps } from 'storybook/internal/types';
|
|
2
|
+
export declare class DocsRenderer {
|
|
3
|
+
render: (context: DocsContextProps, docsParameter: {
|
|
4
|
+
components?: Record<string, unknown>;
|
|
5
|
+
}, element: HTMLElement) => Promise<void>;
|
|
6
|
+
unmount: (element: HTMLElement) => void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/client/docs/renderer.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAqCjE,qBAAa,YAAY;IACvB,MAAM,GACJ,SAAS,gBAAgB,EACzB,eAAe;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EACvD,SAAS,WAAW,mBAqBpB;IAEF,OAAO,GAAI,SAAS,WAAW,UAE7B;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/client/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI3E,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,aAAa,CAc7C,CAAC;AAuEF,wBAAsB,cAAc,CAClC,EACE,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACb,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EAChE,aAAa,EAAE,aAAa,CAAC,eAAe,CAAC,uBAmH9C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type Application from '@ember/application';
|
|
2
2
|
import type ApplicationInstance from '@ember/application/instance';
|
|
3
|
+
import type Owner from '@ember/owner';
|
|
3
4
|
import type { StoryContext as DefaultStoryContext, WebRenderer } from 'storybook/internal/types';
|
|
4
5
|
export type { RenderContext } from 'storybook/internal/types';
|
|
5
6
|
export interface ShowErrorArgs {
|
|
@@ -10,7 +11,9 @@ export type AppParamater = typeof Application | ApplicationInstance | ((options?
|
|
|
10
11
|
export interface EmberParameters {
|
|
11
12
|
ember?: {
|
|
12
13
|
app?: AppParamater;
|
|
14
|
+
configure?: (app: ApplicationInstance) => void;
|
|
13
15
|
owner?: Record<`${string}:${string}`, object>;
|
|
16
|
+
updateGlobals?: (globals: Record<string, unknown>, owner: Owner) => void;
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
export interface EmberRenderer extends WebRenderer {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEjG,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GACpB,OAAO,WAAW,GAClB,mBAAmB,GACnB,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,WAAW,GAAG,mBAAmB,CAAC,CAAC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CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,MAAM,YAAY,GAAG,mBAAmB,CAAC,aAAa,CAAC,GAAG;IAC9D,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,GAAG,eAAe,CAAC;CAChF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,yBAAyB,CAAC;AAKvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAsB,MAAM,yBAAyB,CAAC;AAKvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAoB/D,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,oBAAoB,CAkBnE,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAkBtD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAE1E,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,MAAM,CAcvC,CAAC"}
|
package/dist/client/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as renderToCanvas, t as render } from "../render-
|
|
1
|
+
import { n as renderToCanvas, t as render } from "../render-B0rRnyCZ.mjs";
|
|
2
2
|
import { enhanceArgTypes } from "storybook/internal/docs-tools";
|
|
3
3
|
//#region src/client/config.ts
|
|
4
4
|
const parameters = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DocsRenderer } from "./renderer.mjs";
|
|
2
|
+
import { parameters as parameters$1 } from "@storybook/addon-docs/preview";
|
|
3
|
+
//#region src/client/docs/preview-patch.ts
|
|
4
|
+
const baseParameters = parameters$1;
|
|
5
|
+
const parameters = {
|
|
6
|
+
...baseParameters,
|
|
7
|
+
docs: {
|
|
8
|
+
...baseParameters.docs,
|
|
9
|
+
renderer: () => Promise.resolve(new DocsRenderer())
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { parameters };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=preview-patch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-patch.mjs","names":["parameters","baseParametersUntyped","DocsRenderer","baseParameters","docs","renderer","Promise","resolve"],"sources":["../../../src/client/docs/preview-patch.ts"],"sourcesContent":["import { parameters as baseParametersUntyped } from '@storybook/addon-docs/preview';\n\nimport { DocsRenderer } from './renderer';\n\n// Re-exports addon-docs' preview `parameters` with `docs.renderer` overridden by\n// our stable-key renderer (see DocsRenderer). The framework's Vite plugin\n// redirects the addon-docs preview annotation import to this module, so the docs\n// page keeps its React tree stable across re-renders instead of remounting it\n// (which destroyed the inline story canvases and caused a reload on globals\n// changes).\nconst baseParameters = baseParametersUntyped as {\n docs: { renderer?: () => Promise<unknown> };\n};\n\nexport const parameters = {\n ...baseParameters,\n docs: {\n ...baseParameters.docs,\n renderer: () => Promise.resolve(new DocsRenderer())\n }\n};\n"],"mappings":";;;AAUA,MAAMG,iBAAiBF;AAIvB,MAAaD,aAAa;CACxB,GAAGG;CACHC,MAAM;EACJ,GAAGD,eAAeC;EAClBC,gBAAgBC,QAAQC,QAAQ,IAAIL,aAAa,CAAC;CACpD;AACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AnchorMdx, CodeOrSourceMdx, Docs, HeadersMdx } from "@storybook/addon-docs/blocks";
|
|
2
|
+
import { Component, createElement } from "react";
|
|
3
|
+
import { renderElement, unmountElement } from "@storybook/react-dom-shim";
|
|
4
|
+
//#region src/client/docs/renderer.ts
|
|
5
|
+
const defaultComponents = {
|
|
6
|
+
code: CodeOrSourceMdx,
|
|
7
|
+
a: AnchorMdx,
|
|
8
|
+
...HeadersMdx
|
|
9
|
+
};
|
|
10
|
+
var ErrorBoundary = class extends Component {
|
|
11
|
+
state = { hasError: false };
|
|
12
|
+
static getDerivedStateFromError() {
|
|
13
|
+
return { hasError: true };
|
|
14
|
+
}
|
|
15
|
+
componentDidCatch(error) {
|
|
16
|
+
this.props.showException(error);
|
|
17
|
+
}
|
|
18
|
+
render() {
|
|
19
|
+
return this.state.hasError ? void 0 : this.props.children;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var DocsRenderer = class {
|
|
23
|
+
render = async (context, docsParameter, element) => {
|
|
24
|
+
const { MDXProvider } = await import("../../react-BcVz11Jd.mjs");
|
|
25
|
+
const components = {
|
|
26
|
+
...defaultComponents,
|
|
27
|
+
...docsParameter.components
|
|
28
|
+
};
|
|
29
|
+
const page = createElement(Docs, {
|
|
30
|
+
context,
|
|
31
|
+
docsParameter
|
|
32
|
+
});
|
|
33
|
+
const provided = createElement(MDXProvider, { components }, page);
|
|
34
|
+
const { promise: renderFailed, reject } = Promise.withResolvers();
|
|
35
|
+
const showException = (error) => {
|
|
36
|
+
reject(error);
|
|
37
|
+
};
|
|
38
|
+
const boundary = createElement(ErrorBoundary, { showException }, provided);
|
|
39
|
+
await Promise.race([renderElement(boundary, element), renderFailed]);
|
|
40
|
+
};
|
|
41
|
+
unmount = (element) => {
|
|
42
|
+
unmountElement(element);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { DocsRenderer };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=renderer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.mjs","names":["AnchorMdx","CodeOrSourceMdx","Docs","HeadersMdx","renderElement","unmountElement","Component","createElement","defaultComponents","code","a","ErrorBoundary","state","hasError","getDerivedStateFromError","componentDidCatch","error","props","showException","render","undefined","children","DocsRenderer","context","docsParameter","element","MDXProvider","components","page","provided","promise","renderFailed","reject","Promise","withResolvers","boundary","race","unmount"],"sources":["../../../src/client/docs/renderer.ts"],"sourcesContent":["// This file is a fork of `@storybook/addon-docs`' `DocsRenderer`, copied from\n// `src/DocsRenderer.tsx` at version 10.5.0. It replicates the docs renderer\n// so we can override a single detail: the `ErrorBoundary` must NOT get a\n// `key={Math.random()}` (see below).\n//\n// RISK: this is a copy of addon-docs internals, not its public API. When\n// `@storybook/addon-docs` is upgraded, the upstream `DocsRenderer` can change\n// (new blocks, different component tree, changed lifecycle) and this fork will\n// silently drift, breaking the docs page. On every addon-docs bump, re-verify\n// this file against the upstream source and port any relevant changes.\nimport { AnchorMdx, CodeOrSourceMdx, Docs, HeadersMdx } from '@storybook/addon-docs/blocks';\nimport { renderElement, unmountElement } from '@storybook/react-dom-shim';\nimport { Component, createElement } from 'react';\n\nimport type { ReactNode } from 'react';\nimport type { DocsContextProps } from 'storybook/internal/types';\n\nconst defaultComponents = {\n code: CodeOrSourceMdx,\n a: AnchorMdx,\n ...HeadersMdx\n};\n\n// Replicates the docs renderer from `@storybook/addon-docs`, except that the\n// ErrorBoundary does NOT get a `key={Math.random()}`. That random key made React\n// unmount and remount the entire docs page on every re-render (e.g. when globals\n// change), which destroyed the inline story canvases and caused the addon to\n// reboot the Ember app. With a stable root the docs page reconciles in place and\n// the canvases stay alive.\n//\n// TRADE-OFF: the upstream key also reset the boundary's `hasError` state on\n// every render. Without it, a transient render error leaves the docs page\n// permanently blank (hasError is never reset) until the app is reloaded.\nclass ErrorBoundary extends Component<\n { showException: (error: unknown) => void; children?: ReactNode },\n { hasError: boolean }\n> {\n override state = { hasError: false };\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n override componentDidCatch(error: Error) {\n this.props.showException(error);\n }\n\n override render() {\n return this.state.hasError ? undefined : this.props.children;\n }\n}\n\nexport class DocsRenderer {\n render = async (\n context: DocsContextProps,\n docsParameter: { components?: Record<string, unknown> },\n element: HTMLElement\n ) => {\n const { MDXProvider } = await import('@mdx-js/react');\n\n const components = {\n ...defaultComponents,\n ...docsParameter.components\n } as never;\n\n const page = createElement(Docs, { context, docsParameter });\n const provided = createElement(MDXProvider, { components }, page);\n\n const { promise: renderFailed, reject } = Promise.withResolvers<never>();\n\n const showException = (error: unknown) => {\n reject(error);\n };\n\n const boundary = createElement(ErrorBoundary, { showException }, provided);\n\n await Promise.race([renderElement(boundary, element), renderFailed]);\n };\n\n unmount = (element: HTMLElement) => {\n unmountElement(element);\n };\n}\n"],"mappings":";;;;AAiBA,MAAMQ,oBAAoB;CACxBC,MAAMR;CACNS,GAAGV;CACH,GAAGG;AACL;AAYA,IAAMQ,gBAAN,cAA4BL,UAG1B;CACSM,QAAQ,EAAEC,UAAU,MAAM;CAEnC,OAAOC,2BAA2B;EAChC,OAAO,EAAED,UAAU,KAAK;CAC1B;CAESE,kBAAkBC,OAAc;EACvC,KAAKC,MAAMC,cAAcF,KAAK;CAChC;CAESG,SAAS;EAChB,OAAO,KAAKP,MAAMC,WAAWO,KAAAA,IAAY,KAAKH,MAAMI;CACtD;AACF;AAEA,IAAaC,eAAb,MAA0B;CACxBH,SAAS,OACPI,SACAC,eACAC,YACG;EACH,MAAM,EAAEC,gBAAgB,MAAM,OAAO;EAErC,MAAMC,aAAa;GACjB,GAAGnB;GACH,GAAGgB,cAAcG;EACnB;EAEA,MAAMC,OAAOrB,cAAcL,MAAM;GAAEqB;GAASC;EAAc,CAAC;EAC3D,MAAMK,WAAWtB,cAAcmB,aAAa,EAAEC,WAAW,GAAGC,IAAI;EAEhE,MAAM,EAAEE,SAASC,cAAcC,WAAWC,QAAQC,cAAqB;EAEvE,MAAMhB,iBAAiBF,UAAmB;GACxCgB,OAAOhB,KAAK;EACd;EAEA,MAAMmB,WAAW5B,cAAcI,eAAe,EAAEO,cAAc,GAAGW,QAAQ;EAEzE,MAAMI,QAAQG,KAAK,CAAChC,cAAc+B,UAAUV,OAAO,GAAGM,YAAY,CAAC;CACrE;CAEAM,WAAWZ,YAAyB;EAClCpB,eAAeoB,OAAO;CACxB;AACF"}
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as renderToCanvas } from "../render-
|
|
2
|
-
import { n as setProjectAnnotations, t as RenderStory } from "../client-
|
|
1
|
+
import { n as renderToCanvas } from "../render-B0rRnyCZ.mjs";
|
|
2
|
+
import { n as setProjectAnnotations, t as RenderStory } from "../client-CjnOdn6v.mjs";
|
|
3
3
|
export { RenderStory, renderToCanvas, setProjectAnnotations };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as render_exports } from "./render-
|
|
1
|
+
import { r as render_exports } from "./render-B0rRnyCZ.mjs";
|
|
2
2
|
import { setDefaultProjectAnnotations, setProjectAnnotations } from "storybook/preview-api";
|
|
3
3
|
import { template } from "@ember/template-compiler";
|
|
4
4
|
import Component from "@glimmer/component";
|
|
@@ -59,4 +59,4 @@ var RenderStory = class extends Component {
|
|
|
59
59
|
//#endregion
|
|
60
60
|
export { setProjectAnnotations$1 as n, RenderStory as t };
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=client-
|
|
62
|
+
//# sourceMappingURL=client-CjnOdn6v.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-
|
|
1
|
+
{"version":3,"file":"client-CjnOdn6v.mjs","names":["globalThis","STORYBOOK_ENV","setDefaultProjectAnnotations","setProjectAnnotations","originalSetProjectAnnotations","INTERNAL_DEFAULT_PROJECT_ANNOTATIONS","projectAnnotations"],"sources":["../src/client/globals.ts","../src/client/portable-stories.ts","../src/client/render-story.gts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line unicorn/no-global-object-property-assignment\nglobalThis.STORYBOOK_ENV = 'ember';\n","import {\n setDefaultProjectAnnotations,\n setProjectAnnotations as originalSetProjectAnnotations\n} from 'storybook/preview-api';\n\nimport * as INTERNAL_DEFAULT_PROJECT_ANNOTATIONS from './render';\n\nimport type { EmberRenderer } from './types';\nimport type {\n NamedOrDefaultProjectAnnotations,\n NormalizedProjectAnnotations\n} from 'storybook/internal/types';\n\n/**\n * Function that sets the globalConfig of your storybook. The global config is the preview module of\n * your .storybook folder.\n *\n * It should be run a single time, so that your global config (e.g. decorators) is applied to your\n * stories when using `composeStories` or `composeStory`.\n *\n * Example:\n *\n * ```jsx\n * // setup-file.js\n * import { setProjectAnnotations } from '@storybook/preact';\n * import projectAnnotations from './.storybook/preview';\n *\n * setProjectAnnotations(projectAnnotations);\n * ```\n *\n * @param projectAnnotations - E.g. (import projectAnnotations from '../.storybook/preview')\n */\nexport function setProjectAnnotations(\n projectAnnotations:\n | NamedOrDefaultProjectAnnotations<EmberRenderer>\n | NamedOrDefaultProjectAnnotations<EmberRenderer>[]\n): NormalizedProjectAnnotations<EmberRenderer> {\n setDefaultProjectAnnotations(INTERNAL_DEFAULT_PROJECT_ANNOTATIONS);\n\n return originalSetProjectAnnotations(projectAnnotations);\n}\n","import Component from '@glimmer/component';\nimport { getOwner } from '@ember/owner';\nimport { renderComponent } from '@ember/renderer';\n\nimport { modifier } from 'ember-modifier';\n\ninterface RenderStorySignature {\n Args: {\n story: () => object;\n args: Record<string, unknown>;\n };\n Element: HTMLDivElement;\n}\n\nexport class RenderStory extends Component<RenderStorySignature> {\n render = modifier((element: HTMLDivElement) => {\n const component = this.args.story();\n const owner = getOwner(this);\n const result = renderComponent(component, {\n args: this.args.args,\n into: element,\n owner\n });\n\n return () => {\n result.destroy();\n };\n });\n\n <template>\n <div {{this.render}}></div>\n </template>\n}\n"],"mappings":";;;;;;;;AAGAA,WAAWC,gBAAgB;;;;;;;;;;;;;;;;;;;;;;AC6B3B,SAAgBE,wBACdG,oBAG6C;CAC7CJ,6BAA6BG,cAAoC;CAEjE,OAAOD,sBAA8BE,kBAAkB;AACzD;;;AC1BA,IAAa,cAAb,cAAiC,UAAU;CACzC,SAAS,UAAU,YAAS;EAC1B,MAAM,YAAY,KAAK,KAAK,MAAK;EACjC,MAAM,QAAQ,SAAS,IAAI;EAC3B,MAAM,SAAS,gBAAgB,WAAW;GACxC,MAAM,KAAK,KAAK;GAChB,MAAM;GACN;EACF,CAAA;EAEA,aAAO;GACL,OAAO,QAAO;EAChB;CACF,CAAA;CAEA;EAAA,SAAU,+BAEV;GAAA,WAAA;GAAA,OAAA;IAAA,OAAA,KAAA,UAAA,EAAW;GAAD;EAAA,CAAA;CAAA;AACZ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as renderToCanvas } from "./render-
|
|
2
|
-
import { n as setProjectAnnotations, t as RenderStory } from "./client-
|
|
1
|
+
import { n as renderToCanvas } from "./render-B0rRnyCZ.mjs";
|
|
2
|
+
import { n as setProjectAnnotations, t as RenderStory } from "./client-CjnOdn6v.mjs";
|
|
3
3
|
export { RenderStory, renderToCanvas, setProjectAnnotations };
|
package/dist/preset.mjs
CHANGED
|
@@ -1408,6 +1408,15 @@ function emberStorybookPlugin() {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
//#endregion
|
|
1410
1410
|
//#region src/preset.ts
|
|
1411
|
+
function docsRendererPlugin(docsPreviewPatch) {
|
|
1412
|
+
return {
|
|
1413
|
+
name: "ember-storybook:docs-renderer",
|
|
1414
|
+
enforce: "pre",
|
|
1415
|
+
resolveId(source) {
|
|
1416
|
+
if (source.includes("@storybook/addon-docs") && source.endsWith("preview.js")) return docsPreviewPatch;
|
|
1417
|
+
}
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1411
1420
|
const previewAnnotations = async (entries = [], options) => {
|
|
1412
1421
|
const config = fileURLToPath(import.meta.resolve("ember-storybook/client/config"));
|
|
1413
1422
|
const annotations = [...entries, config];
|
|
@@ -1421,8 +1430,9 @@ const previewAnnotations = async (entries = [], options) => {
|
|
|
1421
1430
|
const viteFinal = async (config) => {
|
|
1422
1431
|
const { mergeConfig } = await import("vite");
|
|
1423
1432
|
config.plugins = await withoutVitePlugins(config.plugins, ["embroider-content-for"]);
|
|
1433
|
+
const docsPreviewPatch = fileURLToPath(import.meta.resolve("ember-storybook/client/docs/preview-patch"));
|
|
1424
1434
|
return mergeConfig(config, {
|
|
1425
|
-
plugins: [...emberStorybookPlugin()],
|
|
1435
|
+
plugins: [...emberStorybookPlugin(), docsRendererPlugin(docsPreviewPatch)],
|
|
1426
1436
|
optimizeDeps: { exclude: ["object-inspect"] },
|
|
1427
1437
|
resolve: { dedupe: ["ember-source"] }
|
|
1428
1438
|
});
|
package/dist/preset.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.mjs","names":["pp","Preprocessor","GTS_EXT","GJS_EXT","GTS_TS_EXT","GJS_TS_EXT","isEmberTSTemplate","fileName","test","isEmberJSTemplate","isEmberTemplate","isEmberTSTemplateWithAppendix","isEmberJSTemplateWithAppendix","isEmberTemplateWithAppendix","originalPath","virtualName","replace","virtualPath","original","processEmberTemplate","raw","readFileSync","process","filename","code","createEmberHost","host","_ts","gtsContentCache","Map","preprocess","cached","get","set","Proxy","target","prop","receiver","languageVersionOrOptions","onError","shouldCreateNewSourceFile","languageVersion","createSourceFile","getSourceFile","fileExists","readFile","Reflect","mapRootNames","rootNames","reverseMap","Array","from","map","name","v","require","createRequire","import","meta","url","patched","load","app","patchSys","origConvert","convert","bind","entryPoints","options","getValue","hasEmber","some","length","compilerOptions","getCompilerOptions","logger","createCompilerHost","ep","program","createProgram","manual","i","sf","displayName","basename","extname","sourceFile","filter","x","error","initializeRepositories","converter","origFileExists","sys","path","origReadFile","encoding","realPath","Default","ts","createRequire","import","meta","url","resolveTsconfigFile","opts","tsconfigFile","resolve","ts$1","findConfigFile","process","cwd","sys","fileExists","resolveTsconfigBase","file","dirname","isEmberTemplate","filePath","endsWith","bootstrapOptions","overrides","baseDir","typedocConfig","typedocConfigFile","options","tsconfig","displayBasePath","skipErrorChecking","excludePrivate","excludeProtected","runConversion","app","files","compilerOptions","getCompilerOptions","logger","host","createEmberHost","createCompilerHost","rootNames","map","program","createProgram","entryPoints","i","rootName","sourceFile","getSourceFile","displayName","basename","extname","filter","Boolean","length","Error","initializeRepositories","converter","convert","resolveEntryPoints","configured","getValue","getParsedCommandLineOfConfigFile","fileNames","expandEntryPoints","glob","absolute","expandDirectories","parseFile","Application","bootstrapWithPlugins","project","serializer","projectToObject","parseProject","readAndPreprocess","rawCode","readFileSync","Preprocessor","filename","code","isStringLiteralType","node","type","literal","String","value","collectStringLiterals","str","types","flatMap","t","extractModifierFromType","typeName","wrapperName","name","typeArgs","typeArguments","params","boundKeys","p","findNestedModifier","mod","param","inner","members","member","innerType","typeAnnotation","extractParamModifiersFromType","typeNode","modifiers","elementTypes","el","key","paramName","push","extractBlockParamModifiers","parseSync","lang","sourceType","Visitor","TSPropertySignature","visit","isPropertySignature","reflection","kind","ReflectionKind","Property","isOptional","flags","sources","fileName","extractSummaryText","comment","summary","text","join","extractDefaultValue","defaultValueTag","blockTags","find","tag","content","c","replace","trim","extractStringLiteralValue","extractTypeReflection","declaration","extractLiteralStrings","derivePackageName","packagePath","withoutNodeModules","parts","split","startsWith","slice","isBlockParam","Object","hasOwn","unwrapBlockParams","values","normalizeReflectionPath","buildReflectionMaps","idToPath","Map","idToReflection","walk","set","id","child","children","isEmberComponent","parsed","get","variant","Variable","Class","extendedTypes","ext","includes","candidate","resolveComponentRefDeep","target","resolved","exportName","packageName","qualifiedName","importPath","ta","nonComponentTypeArgs","m","modTypeArgs","queryType","trueType","falseType","typeToString","elements","elementType","signatures","sig","parameters","checkType","extendsType","objectType","indexType","targetType","head","tail","operator","extractTypeString","typeToArgTypeInfo","category","raw","props","buildArgTypeInfo","properties","keys","literals","Method","isArgSignature","parseArgsProperty","prop","args","required","description","defaultValue","parseBlocksProperty","blocks","blockType","TypeLiteral","componentRef","element","hash","parseElementProperty","parseStyleProperty","result","customProperties","cpMembers","cp","partMembers","part","assignProperty","style","parseSignatureProperty","parseInterfaceSignature","hasArgs","some","hasBlocks","hasElement","hasStyle","recurseChildren","fn","extractInterfaceSignatures","add","Interface","Module","Namespace","deriveComponentName","resolveSigId","has","qn","entry","associateReflection","copy","componentName","associateComponents","associate","resolveMarkerRefs","compSigs","entries","componentNames","compSig","blockInfo","enrichBlockParamModifiers","base","relPath","absKey","path","existsSync","analyze","reflections","path","COMPONENT_RE","PROJECT_ROOT","process","cwd","Default","normalizeFilePath","absPath","relative","replaceAll","storyFiles","Set","listeners","addStoryFileListener","listener","add","delete","registerStoryFile","filePath","getStoryFiles","isStoryFile","has","isComponentFile","test","readFile","Preprocessor","loadCsf","registerStoryFile","parse","fileName","code","preprocessor","process","filename","readCsf","options","result","emberIndexer","test","createIndex","rawCode","csf","parsed","inputs","indexInputs","readFileSync","path","Preprocessor","parseSync","Visitor","loadCsf","Default","normalizeFilePath","readAndPreprocess","filePath","rawCode","endsWith","processedCode","pp","result","process","filename","code","parseProcessedCode","lang","sourceType","program","firstVarExportName","declarations","length","undefined","first","id","type","name","firstSpecExportName","specifiers","exported","firstSpecLocalName","local","findSignatureName","compMeta","importedName","Object","hasOwn","parseComponentFile","compPath","handled","Set","visitor","ExportNamedDeclaration","node","declaration","has","add","specExported","specLocal","VariableDeclaration","ExportDefaultDeclaration","decl","internalName","visit","keys","parseStoryFile","storyPath","meta","stories","csf","fileName","makeTitle","userTitle","parsed","parse","importMap","Map","exportStack","ImportDeclaration","spec","imported","value","set","source","story","find","s","localName","push","ExportNamedDeclaration:exit","pop","CallExpression","currentStory","at","inlineTemplate","callee","startsWith","arguments","firstArg","raw","quasis","localComponentName","component","importInfo","get","signatureName","resolve","dirname","file","addStoryFileListener","isComponentFile","normalizeFilePath","VIRTUAL","RESOLVED","emberStorybookVitePlugin","api","server","invalidate","mod","moduleGraph","getModuleById","invalidateModule","ws","send","type","name","resolveId","id","load","contributions","getContributions","merged","data","filePath","value","Object","entries","relPath","normalizedValue","compValue","file","code","JSON","stringify","map","undefined","handleHotUpdate","ctx","virtualMod","configureServer","srv","existsSync","path","analyze","parseFile","unwrapBlockParams","normalizeFilePath","resolveTsconfigBase","findUp","dir","join","parent","dirname","undefined","process","cwd","rewriteFilePaths","mapped","base","compSigs","Object","values","compSig","blockInfo","blocks","param","params","componentRef","filePath","resolve","runTypeDoc","entryPoints","length","file","json","extracted","relPath","entries","absKey","assign","error","console","warn","path","parseStoryFile","getStoryFiles","isComponentFile","isStoryFile","runTypeDoc","isReferenced","state","componentFile","abs","resolve","r","storyToRef","values","componentPath","resolveComponentRef","storyFilePath","result","component","file","undefined","componentName","meta","addSignatures","componentPaths","absPaths","map","cp","missing","filter","Object","hasOwn","signatures","length","newSigs","merged","filePath","compSigs","entries","signaturesContributor","api","Map","contributeState","contribute","discoverAll","files","next","ref","set","processStoryAdd","storyFile","processStoryChange","delete","processStoryUnlink","processComponentChange","absFile","name","buildStart","allPaths","Set","Array","from","configureServer","server","watcher","on","changedFile","parseStoryFile","getStoryFiles","isComponentFile","isStoryFile","computeDataForStory","file","storyResult","meta","component","signatureName","metaContributor","api","fileMeta","fileComponent","recontribute","contribute","syncAll","data","storiesForComponent","compPath","Object","entries","filter","v","map","k","name","buildStart","configureServer","server","watcher","on","changedPath","storyPath","parseStoryFile","getStoryFiles","isStoryFile","sourceContributor","api","fileMeta","contribute","extractSource","filePath","result","output","story","stories","id","inlineTemplate","componentName","component","name","signatureName","refreshMeta","storyPath","buildStart","files","filter","f","data","file","configureServer","server","watcher","on","Reflect","deleteProperty","signaturesContributor","metaContributor","sourceContributor","emberStorybookVitePlugin","emberStorybookPlugin","contributions","Map","api","contribute","name","data","set","invalidate","getContributions","fileURLToPath","withoutVitePlugins","emberIndexer","emberStorybookPlugin","previewAnnotations","entries","options","config","import","meta","resolve","annotations","docsConfig","presets","apply","docsEnabled","Object","keys","length","docsConfigPath","push","viteFinal","mergeConfig","plugins","optimizeDeps","exclude","dedupe","experimental_indexers","indexers","core","framework","builder","name"],"sources":["../../src/ember-host.ts","../../src/index.ts","../../src/types.ts","../../src/config.ts","../../src/parse.ts","../../src/parser.ts","../../src/signature-extractor.ts","../src/node/shared.ts","../src/node/indexer.ts","../src/node/parser.ts","../src/node/vite-plugin-orchestrator.ts","../src/node/docgen/docgen.ts","../src/node/docgen/vite-plugin.ts","../src/node/meta/vite-plugin.ts","../src/node/source/vite-plugin.ts","../src/node/vite-plugin.ts","../src/preset.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport { Preprocessor } from 'content-tag';\n\nimport type ts from 'typescript';\n\nconst pp = new Preprocessor();\n\nconst GTS_EXT = /\\.gts$/;\nconst GJS_EXT = /\\.gjs$/;\nconst GTS_TS_EXT = /\\.gts\\.ts$/;\nconst GJS_TS_EXT = /\\.gjs\\.ts$/;\n\nexport function isEmberTSTemplate(fileName: string) {\n return GTS_EXT.test(fileName);\n}\n\nexport function isEmberJSTemplate(fileName: string) {\n return GJS_EXT.test(fileName);\n}\n\nexport function isEmberTemplate(fileName: string) {\n return isEmberTSTemplate(fileName) || isEmberJSTemplate(fileName);\n}\n\nexport function isEmberTSTemplateWithAppendix(fileName: string) {\n return GTS_TS_EXT.test(fileName);\n}\n\nexport function isEmberJSTemplateWithAppendix(fileName: string) {\n return GJS_TS_EXT.test(fileName);\n}\n\nexport function isEmberTemplateWithAppendix(fileName: string) {\n return isEmberTSTemplateWithAppendix(fileName) || isEmberJSTemplateWithAppendix(fileName);\n}\n\nexport function originalPath(virtualName: string) {\n return virtualName.replace(/\\.(gts|gjs)\\.ts$/, '.$1');\n}\n\nexport function virtualPath(original: string) {\n return original + '.ts';\n}\n\nexport function processEmberTemplate(fileName: string) {\n const raw = readFileSync(fileName, 'utf8');\n return pp.process(raw, { filename: fileName }).code;\n}\n\n/**\n * Wraps a TypeScript CompilerHost to handle .gts/.gjs files:\n *\n * - Virtual root names: `.gts` → `.gts.ts` so TypeScript includes them\n * - `getSourceFile`: preprocesses via content-tag, returns valid TS\n * - `fileExists`: recognizes both original and virtual paths\n * - `readFile`: serves preprocessed content for virtual paths\n */\nexport function createEmberHost(host: ts.CompilerHost, _ts: typeof ts): ts.CompilerHost {\n const gtsContentCache = new Map<string, string>();\n\n function preprocess(fileName: string): string {\n let cached = gtsContentCache.get(fileName);\n if (cached === undefined) {\n cached = processEmberTemplate(fileName);\n gtsContentCache.set(fileName, cached);\n }\n return cached;\n }\n\n return new Proxy(host, {\n get(target, prop, receiver) {\n // getSourceFile intercept: preprocess .gts/.gjs files\n if (prop === 'getSourceFile') {\n return (\n fileName: string,\n languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ) => {\n // Handle virtual .gts.ts files\n if (isEmberTemplateWithAppendix(fileName)) {\n const orig = originalPath(fileName);\n const code = preprocess(orig);\n const languageVersion =\n typeof languageVersionOrOptions === 'number'\n ? languageVersionOrOptions\n : languageVersionOrOptions.languageVersion;\n return _ts.createSourceFile(fileName, code, languageVersion);\n }\n\n // Handle direct .gts/.gjs files (for module resolution of imports)\n if (isEmberTemplate(fileName)) {\n const code = preprocess(fileName);\n const languageVersion =\n typeof languageVersionOrOptions === 'number'\n ? languageVersionOrOptions\n : languageVersionOrOptions.languageVersion;\n return _ts.createSourceFile(fileName, code, languageVersion);\n }\n\n return target.getSourceFile!(\n fileName,\n languageVersionOrOptions as ts.ScriptTarget,\n onError,\n shouldCreateNewSourceFile\n );\n };\n }\n\n if (prop === 'fileExists') {\n return (fileName: string) => {\n // Virtual .gts.ts → check original\n if (isEmberTemplateWithAppendix(fileName)) {\n return target.fileExists!(originalPath(fileName));\n }\n // .gts/.gjs files exist\n if (isEmberTemplate(fileName)) {\n return target.fileExists!(fileName);\n }\n return target.fileExists!(fileName);\n };\n }\n\n // readFile: serve preprocessed content for virtual/module resolution\n if (prop === 'readFile') {\n return (fileName: string) => {\n if (isEmberTemplateWithAppendix(fileName)) {\n return preprocess(originalPath(fileName));\n }\n if (isEmberTemplate(fileName)) {\n return preprocess(fileName);\n }\n return target.readFile!(fileName);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n/**\n * Maps root names so .gts/.gjs files are renamed to .gts.ts/.gjs.ts\n * so TypeScript includes them (it only processes .ts/.tsx/.js/.jsx).\n * Returns the new list + a reverse-map for the caller.\n */\nexport function mapRootNames(\n rootNames: readonly string[]\n): [string[], Map<string, string>] {\n const reverseMap = new Map<string, string>();\n\n const mapped = Array.from(rootNames).map((name) => {\n if (isEmberTSTemplate(name)) {\n const v = virtualPath(name);\n reverseMap.set(v, name);\n return v;\n }\n if (isEmberJSTemplate(name)) {\n const v = virtualPath(name);\n reverseMap.set(v, name);\n return v;\n }\n return name;\n });\n\n return [mapped, reverseMap];\n}\n","import { basename, extname } from 'node:path';\nimport { createRequire } from 'node:module';\n\nimport { Preprocessor } from 'content-tag';\nimport type { Application, DocumentationEntryPoint } from 'typedoc';\n\nexport { createEmberHost, mapRootNames, processEmberTemplate, isEmberTemplate, isEmberTemplateWithAppendix, originalPath, virtualPath } from './ember-host';\n\nimport { createEmberHost, isEmberTemplate, isEmberTemplateWithAppendix, originalPath, virtualPath } from './ember-host';\n\nconst require = createRequire(import.meta.url);\n\nlet patched = false;\n\nexport function load(app: Application) {\n if (!patched) {\n patched = true;\n patchSys();\n }\n\n // Override convert() to handle .gts/.gjs entry points via a manually\n // created TypeScript program, bypassing TypeDoc's expandGlobs (which\n // requires all files to exist on disk).\n const origConvert = app.convert.bind(app);\n app.convert = async () => {\n const entryPoints: string[] = app.options.getValue('entryPoints');\n const hasEmber = entryPoints.some(isEmberTemplate);\n\n if (!entryPoints.length || !hasEmber) {\n return origConvert();\n }\n\n const _ts = require('typescript') as typeof import('typescript');\n const compilerOptions = app.options.getCompilerOptions(app.logger);\n const host = createEmberHost(_ts.createCompilerHost(compilerOptions), _ts);\n\n const rootNames = entryPoints.map((ep) =>\n isEmberTemplate(ep) ? virtualPath(ep) : ep,\n );\n\n const program = _ts.createProgram({\n rootNames,\n options: compilerOptions,\n host,\n });\n\n const manual: DocumentationEntryPoint[] = entryPoints\n .map((ep, i) => {\n const sf = program.getSourceFile(rootNames[i]);\n if (!sf) return null;\n return {\n displayName: basename(ep, extname(ep)),\n sourceFile: sf,\n program,\n };\n })\n .filter((x): x is DocumentationEntryPoint => x !== null);\n\n if (!manual.length) {\n app.logger.error('No entry points could be resolved');\n return;\n }\n\n await app.initializeRepositories(manual);\n return app.converter.convert(manual);\n };\n}\n\nfunction patchSys() {\n let _ts: typeof import('typescript');\n\n try {\n _ts = require('typescript');\n } catch {\n return;\n }\n\n const pp = new Preprocessor();\n\n // Make ts.sys recognize virtual .gts.ts files by mapping file existence\n // and content reads to the real .gts/.gjs files on disk.\n const origFileExists = _ts.sys.fileExists.bind(_ts.sys);\n _ts.sys.fileExists = (path: string) => {\n if (isEmberTemplateWithAppendix(path)) {\n return origFileExists(originalPath(path));\n }\n return origFileExists(path);\n };\n\n const origReadFile = _ts.sys.readFile.bind(_ts.sys);\n _ts.sys.readFile = (path: string, encoding?: string) => {\n if (isEmberTemplateWithAppendix(path)) {\n const realPath = originalPath(path);\n const raw = origReadFile(realPath, encoding);\n if (raw != null) {\n return pp.process(raw, { filename: realPath }).code;\n }\n return raw;\n }\n return origReadFile(path, encoding);\n };\n}\n","import type { TypeDocOptions as TypeDocConfig } from 'typedoc';\n\nexport type ArgTypeCategory =\n | 'string'\n | 'number'\n | 'boolean'\n | 'function'\n | 'object'\n | 'array'\n | 'enum'\n | 'union'\n | 'symbol'\n | 'other';\n\nexport interface ArgTypeInfo {\n /** The semantic type category */\n category: ArgTypeCategory;\n /** Full type string for display (e.g. \"string\", \"(value: string) => void\", \"'small' | 'medium' | 'large'\") */\n raw: string;\n /** For 'enum': the literal option values */\n options?: string[];\n /** For 'array': the element type */\n elementType?: ArgTypeInfo;\n /** For 'object': known property names mapped to their types */\n properties?: Record<string, ArgTypeInfo>;\n}\n\nexport interface ArgInfo {\n type: ArgTypeInfo;\n required: boolean;\n description: string;\n defaultValue?: string;\n}\n\nexport interface ComponentSignature {\n args: Record<string, ArgInfo>;\n blocks: Record<string, BlockInfo>;\n element: string | undefined;\n style: {\n customProperties: Record<string, string>;\n parts: Record<string, string>;\n };\n}\n\nexport interface BlockParam {\n name: string;\n type: string;\n description?: string;\n componentRef?:\n | undefined\n | {\n filePath: string;\n exportName: string;\n importPath?: string;\n modifiers?: { name: string; typeArgs: string[] }[];\n };\n}\n\n/** A yield hash block param, keyed by the hash key (e.g. `{ Option: ... }`) */\nexport type HashBlockParam = Record<string, BlockParam>;\n\nexport interface BlockInfo {\n params: (BlockParam | HashBlockParam)[];\n description?: string;\n}\n\nexport type ComponentSignatureMap = Record<string, Record<string, ComponentSignature>>;\n\n/** Key used for default-export components */\nexport const Default = '__DEFAULT__';\n\n/**\n * Shared options for parseFile/parseProject/analyze.\n *\n * Precedence for typedoc settings:\n * inline `typedocConfig` > `typedocConfigFile` > TypeDoc default discovery.\n * `tsconfigFile` acts as the path anchor: parse pins TypeDoc's displayBasePath\n * to the tsconfig directory so JSON sources are relative to a base that\n * analyze() can re-derive from the same opts.\n */\nexport interface DocgenOptions {\n /** Path to tsconfig.json. If omitted, discovered walking up from cwd. */\n tsconfigFile?: string;\n /** Path to typedoc.json / typedoc.config.js. If omitted, TypeDoc discovers it. */\n typedocConfigFile?: string;\n /** Inline typedoc options, merged on top of typedocConfigFile / defaults. */\n typedocConfig?: Partial<TypeDocConfig>;\n}\n","import { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\n\n// eslint-disable-next-line import-x/default\nimport type TS from 'typescript';\n\nconst require = createRequire(import.meta.url);\nconst ts = require('typescript') as typeof TS;\n\nimport type { DocgenOptions } from './types';\n\n/**\n * Resolve the tsconfig file, replicating TypeDoc's discovery:\n * explicit `tsconfigFile` when given, else walk up from cwd.\n * Returns undefined when no tsconfig can be found.\n */\nexport function resolveTsconfigFile(opts?: DocgenOptions): string | undefined {\n if (opts?.tsconfigFile) {\n return resolve(opts.tsconfigFile);\n }\n\n return ts.findConfigFile(process.cwd(), ts.sys.fileExists) ?? undefined;\n}\n\n/**\n * The path anchor shared by parse and analyze.\n *\n * parse pins TypeDoc's displayBasePath to this directory so JSON\n * sources are relative to it; analyze re-derives it from the same opts.\n */\nexport function resolveTsconfigBase(opts?: DocgenOptions): string | undefined {\n const file = resolveTsconfigFile(opts);\n\n return file ? dirname(file) : undefined;\n}\n","import { createRequire } from 'node:module';\nimport { basename, extname } from 'node:path';\n\nimport { glob } from 'tinyglobby';\nimport { Application, type DocumentationEntryPoint, type ProjectReflection } from 'typedoc';\nimport { createEmberHost } from 'typedoc-plugin-ember';\n\nimport { resolveTsconfigBase, resolveTsconfigFile } from './config';\n\nimport type { DocgenOptions } from './types';\nimport type { JSONOutput, TypeDocOptions } from 'typedoc';\n\nconst require = createRequire(import.meta.url);\n// eslint-disable-next-line import-x/default\nimport type TS from 'typescript';\n\nconst ts = require('typescript') as typeof TS;\n\nfunction isEmberTemplate(filePath: string): boolean {\n return filePath.endsWith('.gts') || filePath.endsWith('.gjs');\n}\n\nfunction bootstrapOptions(\n opts: DocgenOptions | undefined,\n overrides: Partial<TypeDocOptions>\n): Partial<TypeDocOptions> {\n const baseDir = resolveTsconfigBase(opts);\n\n return {\n ...opts?.typedocConfig,\n ...(opts?.typedocConfigFile ? { options: opts.typedocConfigFile } : {}),\n tsconfig: resolveTsconfigFile(opts),\n ...(baseDir ? { displayBasePath: baseDir } : {}),\n skipErrorChecking: true,\n excludePrivate: false,\n excludeProtected: false,\n ...overrides\n };\n}\n\n/**\n * Shared pipeline: build the ember-aware TypeScript program and convert it.\n *\n * This is the manual .gts translation (createEmberHost + virtual .gts.ts\n * root names), not typedoc-plugin-ember's load() hook — that hook is broken\n * for glob-based entry points.\n */\nasync function runConversion(\n app: Application,\n files: string[]\n): Promise<ProjectReflection> {\n const compilerOptions = app.options.getCompilerOptions(app.logger);\n const host = createEmberHost(ts.createCompilerHost(compilerOptions), ts);\n\n const rootNames = files.map((file) => (isEmberTemplate(file) ? file + '.ts' : file));\n\n const program = ts.createProgram({\n rootNames,\n options: compilerOptions,\n host\n });\n\n const entryPoints = files\n .map((file, i) => {\n const rootName = rootNames[i];\n const sourceFile = program.getSourceFile(rootName);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sourceFile) return null;\n\n return {\n displayName: basename(file, extname(file)),\n sourceFile,\n program\n };\n })\n .filter(Boolean) as DocumentationEntryPoint[];\n\n if (entryPoints.length === 0) {\n throw new Error('No entry points could be resolved');\n }\n\n await app.initializeRepositories(entryPoints);\n\n return app.converter.convert(entryPoints);\n}\n\nfunction resolveEntryPoints(\n app: Application,\n tsconfigFile: string | undefined\n): string[] {\n const configured = app.options.getValue('entryPoints') as string[];\n\n if (configured.length > 0) {\n return configured;\n }\n\n if (!tsconfigFile) return [];\n\n // Fall back to tsconfig include/files\n const parsed = ts.getParsedCommandLineOfConfigFile(\n tsconfigFile,\n {},\n ts.sys as never\n );\n\n return parsed?.fileNames ?? [];\n}\n\nasync function expandEntryPoints(entryPoints: string[]): Promise<string[]> {\n const files = await glob(entryPoints, {\n cwd: process.cwd(),\n absolute: true,\n expandDirectories: false\n });\n\n return files;\n}\n\n/**\n * Run typedoc on a single file and return the typedoc project JSON.\n */\nexport async function parseFile(\n file: string,\n opts?: DocgenOptions\n): Promise<JSONOutput.ProjectReflection> {\n const baseDir = resolveTsconfigBase(opts);\n\n const app = await Application.bootstrapWithPlugins(\n bootstrapOptions(opts, { entryPoints: [file] })\n );\n\n const project = await runConversion(app, [file]);\n\n return app.serializer.projectToObject(project, baseDir as never);\n}\n\n/**\n * Run typedoc on the project's entry points (from typedoc config,\n * falling back to tsconfig include/files) and return the JSON.\n */\nexport async function parseProject(\n opts?: DocgenOptions\n): Promise<JSONOutput.ProjectReflection> {\n const baseDir = resolveTsconfigBase(opts);\n\n const app = await Application.bootstrapWithPlugins(bootstrapOptions(opts, {}));\n\n const entryPoints = resolveEntryPoints(app, resolveTsconfigFile(opts));\n const files = await expandEntryPoints(entryPoints);\n\n if (files.length === 0) {\n throw new Error('No entry points could be resolved');\n }\n\n const project = await runConversion(app, files);\n\n return app.serializer.projectToObject(project, baseDir as never);\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Preprocessor } from 'content-tag';\nimport { parseSync, Visitor } from 'oxc-parser';\n\nexport interface BlockParamModifier {\n paramName: string;\n wrapperName: string;\n boundKeys: string[];\n}\n\nfunction readAndPreprocess(filePath: string): string {\n const rawCode = readFileSync(filePath, 'utf8');\n\n if (!filePath.endsWith('.gts') && !filePath.endsWith('.gjs')) {\n return rawCode;\n }\n\n const pp = new Preprocessor();\n\n return pp.process(rawCode, { filename: filePath }).code;\n}\n\nfunction isStringLiteralType(node: Record<string, unknown>): string | undefined {\n if (node.type === 'TSLiteralType') {\n const literal = node.literal as Record<string, unknown> | undefined;\n\n if (literal?.type === 'Literal') {\n return String(literal.value);\n }\n }\n\n return undefined;\n}\n\nfunction collectStringLiterals(node: Record<string, unknown>): string[] {\n const str = isStringLiteralType(node);\n\n if (str !== undefined) return [str];\n\n if (node.type === 'TSUnionType') {\n const types = node.types as Record<string, unknown>[] | undefined;\n\n return (types ?? []).flatMap((t) => collectStringLiterals(t));\n }\n\n return [];\n}\n\nfunction extractModifierFromType(\n node: Record<string, unknown>\n): undefined | { wrapperName: string; boundKeys: string[] } {\n if (node.type !== 'TSTypeReference') return undefined;\n\n const typeName = node.typeName as Record<string, unknown> | undefined;\n\n if (typeName?.type !== 'Identifier') return undefined;\n\n const wrapperName = typeName.name as string;\n const typeArgs = node.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type !== 'TSTypeParameterInstantiation') return undefined;\n\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n if (!params || params.length === 0) return undefined;\n\n // Collect string literals from all type parameters\n const boundKeys = params.flatMap((p) => collectStringLiterals(p));\n\n if (boundKeys.length === 0) return undefined;\n\n return { wrapperName, boundKeys };\n}\n\n/**\n * Walk the type tree to find the first modifier (TSTypeReference with string\n * literal type arguments) nested anywhere inside the given type node.\n */\nfunction findNestedModifier(\n node: Record<string, unknown>\n): undefined | { wrapperName: string; boundKeys: string[] } {\n const mod = extractModifierFromType(node);\n\n if (mod) return mod;\n\n if (node.type === 'TSTypeReference') {\n const typeArgs = node.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type === 'TSTypeParameterInstantiation') {\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n for (const param of params ?? []) {\n const inner = findNestedModifier(param);\n\n if (inner) return inner;\n }\n }\n }\n\n if (node.type === 'TSIntersectionType' || node.type === 'TSUnionType') {\n const types = node.types as Record<string, unknown>[] | undefined;\n\n for (const t of types ?? []) {\n const inner = findNestedModifier(t);\n\n if (inner) return inner;\n }\n }\n\n if (node.type === 'TSTypeLiteral') {\n const members = node.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const ta = member.typeAnnotation as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (!innerType) continue;\n\n const inner = findNestedModifier(innerType);\n\n if (inner) return inner;\n }\n }\n }\n\n return undefined;\n}\n\nfunction extractParamModifiersFromType(\n typeNode: Record<string, unknown>,\n modifiers: BlockParamModifier[]\n): void {\n if (typeNode.type === 'TSTupleType') {\n const elementTypes = typeNode.elementTypes as Record<string, unknown>[] | undefined;\n\n for (const el of elementTypes ?? []) {\n if (el.type === 'TSTypeLiteral') {\n const members = el.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const key = member.key as Record<string, unknown> | undefined;\n const paramName = key?.type === 'Identifier' ? (key.name as string) : undefined;\n\n if (paramName) {\n const ta = member.typeAnnotation as Record<string, unknown> | undefined;\n const innerType = ta?.typeAnnotation as Record<string, unknown> | undefined;\n\n if (innerType) {\n const mod = extractModifierFromType(innerType) ?? findNestedModifier(innerType);\n\n if (mod) {\n modifiers.push({ paramName, ...mod });\n } else {\n extractParamModifiersFromType(innerType, modifiers);\n }\n }\n }\n }\n }\n }\n }\n }\n\n // TSTypeReference with type arguments — walk into them (e.g. ComponentLike<{...}>)\n if (typeNode.type === 'TSTypeReference') {\n const typeArgs = typeNode.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type === 'TSTypeParameterInstantiation') {\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n for (const param of params ?? []) {\n extractParamModifiersFromType(param, modifiers);\n }\n }\n }\n\n // Intersection types (e.g. Omit<...> & { kind?: ... })\n if (typeNode.type === 'TSIntersectionType') {\n const types = typeNode.types as Record<string, unknown>[] | undefined;\n\n for (const t of types ?? []) {\n extractParamModifiersFromType(t, modifiers);\n }\n }\n\n // Named block params: recurse into nested types to find tuple-based patterns.\n if (typeNode.type === 'TSTypeLiteral') {\n const members = typeNode.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const ta = member.typeAnnotation as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (innerType) {\n extractParamModifiersFromType(innerType, modifiers);\n }\n }\n }\n }\n}\n\nexport function extractBlockParamModifiers(filePath: string): BlockParamModifier[] {\n const code = readAndPreprocess(filePath);\n\n const program = parseSync(filePath, code, {\n lang: filePath.endsWith('.gts') || filePath.endsWith('.ts') ? 'ts' : 'js',\n sourceType: 'module'\n }).program;\n\n const modifiers: BlockParamModifier[] = [];\n\n const visitor = new Visitor({\n TSPropertySignature(node) {\n const key = node.key as unknown as undefined | { type?: string; name?: string };\n\n if (key?.type !== 'Identifier') return;\n if (key.name !== 'Blocks') return;\n\n const ta = node.typeAnnotation as unknown as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (!innerType) return;\n\n extractParamModifiersFromType(innerType, modifiers);\n }\n });\n\n visitor.visit(program);\n\n return modifiers;\n}\n","import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\n/* eslint-disable @typescript-eslint/no-unnecessary-condition --\n * JSONOutput types are strict discriminated unions, but the data comes\n * from deserialized JSON at runtime so every property is nullable. */\nimport { ReflectionKind } from 'typedoc';\n\nimport { extractBlockParamModifiers } from './parser';\nimport { resolveTsconfigBase } from './config';\nimport { Default } from './types';\n\nimport type {\n ArgInfo,\n ArgTypeCategory,\n ArgTypeInfo,\n BlockInfo,\n BlockParam,\n ComponentSignature,\n ComponentSignatureMap,\n DocgenOptions,\n HashBlockParam\n} from './types';\nimport type { JSONOutput } from 'typedoc';\n\n// ── Types ──────────────────────────────────────────────────────\n\ninterface ParsedSignature {\n sig: ComponentSignature;\n name: string;\n file: string | undefined;\n}\n\ntype ComponentRef = {\n filePath: string;\n exportName: string;\n importPath?: string;\n modifiers?: { name: string; typeArgs: string[] }[];\n};\n\ntype TypeDocReflection = JSONOutput.DeclarationReflection;\ntype TypeDocType = JSONOutput.SomeType;\n\n// ── Primitive helpers ──────────────────────────────────────────\n\nfunction isPropertySignature(reflection: TypeDocReflection): boolean {\n return reflection.kind === ReflectionKind.Property;\n}\n\nfunction isOptional(reflection: TypeDocReflection): boolean {\n return reflection.flags?.isOptional ?? false;\n}\n\nfunction sourceFile(reflection: TypeDocReflection): string | undefined {\n return reflection.sources?.[0]?.fileName;\n}\n\nfunction extractSummaryText(comment: JSONOutput.Comment | undefined): string {\n if (!comment?.summary) return '';\n\n return comment.summary\n .filter((p) => p.kind === 'text')\n .map((p) => p.text)\n .join(' ');\n}\n\nfunction extractDefaultValue(reflection: TypeDocReflection): string | undefined {\n const defaultValueTag = reflection.comment?.blockTags?.find(\n (t) => t.tag === '@default' || t.tag === '@defaultValue'\n );\n\n if (defaultValueTag) {\n const raw = defaultValueTag.content.map((c) => c.text).join(' ');\n\n return raw\n .replace(/^```\\w*\\s*/, '')\n .replace(/```$/, '')\n .trim();\n }\n\n return undefined;\n}\n\nfunction extractStringLiteralValue(reflection: TypeDocReflection): string | undefined {\n if (reflection.type?.type === 'literal' && typeof reflection.type.value === 'string') {\n return reflection.type.value;\n }\n\n return undefined;\n}\n\nfunction extractTypeReflection(reflection: TypeDocReflection): TypeDocReflection | undefined {\n if (reflection.type?.type === 'reflection' && reflection.type.declaration) {\n return reflection.type.declaration;\n }\n\n return undefined;\n}\n\nfunction extractLiteralStrings(type: TypeDocType): string[] {\n if (type.type === 'literal' && typeof type.value === 'string') return [type.value];\n if (type.type === 'union') return (type.types ?? []).flatMap((t) => extractLiteralStrings(t));\n\n return [];\n}\n\nfunction derivePackageName(packagePath: string): string {\n const withoutNodeModules = packagePath.replace(/^node_modules\\//, '');\n const parts = withoutNodeModules.split('/');\n\n // Scoped package: @scope/name\n if (parts[0]?.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n // Unscoped: package-name\n return parts[0] ?? withoutNodeModules;\n}\n\n// ── Block param helpers ────────────────────────────────────────\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\n/** Flatten the params union into plain block params, unwrapping yield hashes. */\nexport function unwrapBlockParams(params: BlockInfo['params']): BlockParam[] {\n return params.flatMap((param) => (isBlockParam(param) ? [param] : Object.values(param)));\n}\n\n// ── Reflection map ─────────────────────────────────────────────\n\nfunction normalizeReflectionPath(fileName: string): string {\n return fileName.replace(/\\.(gts|gjs)\\.ts$/, '.$1');\n}\n\nfunction buildReflectionMaps(project: JSONOutput.ProjectReflection): {\n idToPath: Map<number, { filePath: string; name: string }>;\n idToReflection: Map<number, TypeDocReflection>;\n} {\n const idToPath = new Map<number, { filePath: string; name: string }>();\n const idToReflection = new Map<number, TypeDocReflection>();\n\n function walk(reflection: TypeDocReflection | JSONOutput.ProjectReflection) {\n idToReflection.set(reflection.id, reflection as never);\n\n if ('sources' in reflection && reflection.sources?.[0]?.fileName) {\n idToPath.set(reflection.id, {\n filePath: normalizeReflectionPath(reflection.sources[0].fileName),\n name: reflection.name === 'default' ? Default : reflection.name\n });\n }\n\n for (const child of reflection.children ?? []) {\n walk(child);\n }\n }\n\n walk(project);\n\n return { idToPath, idToReflection };\n}\n\nfunction isEmberComponent(\n id: number,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>\n): boolean {\n const reflection = idToReflection.get(id);\n\n if (!reflection) return false;\n if (reflection.variant === 'reference') return false;\n\n // Must be a class or variable\n if (reflection.kind !== ReflectionKind.Variable && reflection.kind !== ReflectionKind.Class) {\n return false;\n }\n\n // Class extends Component<Signature>\n if (reflection.kind === ReflectionKind.Class && reflection.extendedTypes) {\n for (const ext of reflection.extendedTypes) {\n if (ext.type === 'reference' && ext.name === 'Component') return true;\n }\n }\n\n // Variable typed as TOC<Signature> / ComponentLike<S> / Invokable<...>\n if (\n reflection.kind === ReflectionKind.Variable &&\n reflection.type?.type === 'reference' &&\n reflection.type.name &&\n ['TOC', 'ComponentLike', 'Invokable'].includes(reflection.type.name)\n ) {\n return true;\n }\n\n // Fallback: class/variable in a file with a *Signature interface\n const file = sourceFile(reflection);\n\n if (!file) return false;\n\n for (const candidate of parsed.values()) {\n if (candidate.file === file) return true;\n }\n\n return false;\n}\n\nfunction resolveComponentRefDeep(\n type: TypeDocType | undefined,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentRef | undefined {\n if (!type) return undefined;\n\n switch (type.type) {\n case 'reference': {\n // Numeric target — is it a known component?\n if (typeof type.target === 'number') {\n if (isEmberComponent(type.target, idToReflection, parsed)) {\n const resolved = idToPath.get(type.target);\n\n if (!resolved) return undefined;\n\n return {\n filePath: resolved.filePath,\n exportName: resolved.name\n };\n }\n\n return undefined;\n }\n\n // Object target — external package\n if (type.target && typeof type.target === 'object') {\n const { packageName, packagePath, qualifiedName } = type.target;\n\n // Skip known Glint utility types — they are base types that components\n // satisfy but are not components themselves. TypeDoc resolves typeof X\n // (where X extends Component) to Invokable, losing the original reference.\n const GLINT_UTILITY_TYPES = [\n 'Invokable',\n 'TOC',\n 'ComponentLike',\n 'HelperLike',\n 'ModifierLike'\n ];\n\n if (qualifiedName && GLINT_UTILITY_TYPES.includes(qualifiedName)) {\n return undefined;\n }\n\n if (packagePath && qualifiedName) {\n return {\n filePath: packagePath,\n exportName: qualifiedName,\n importPath: packageName ?? derivePackageName(packagePath)\n };\n }\n }\n\n // Reference with typeArguments — walk inside wrappers\n if (type.typeArguments) {\n // We need to find which type argument leads to a component.\n // Try each; the first that resolves is the component, the rest are modifier metadata.\n for (const ta of type.typeArguments) {\n const inner = resolveComponentRefDeep(ta, idToReflection, idToPath, parsed);\n\n if (inner) {\n // Collect non-component type arguments as modifier metadata\n const nonComponentTypeArgs = type.typeArguments.flatMap((t) =>\n t === ta ? [] : extractLiteralStrings(t)\n );\n\n const m: { name: string; typeArgs: string[] } = {\n name: type.name ?? '',\n typeArgs: nonComponentTypeArgs\n };\n\n return {\n ...inner,\n modifiers: [...(inner.modifiers ?? []), m]\n };\n }\n }\n\n // No component found in any type argument. This happens when\n // TypeDoc resolves typeof ComponentX to a Glint utility type\n // (like Invokable) which we skip. The wrapper still has modifier\n // info (string literal type args). Return a marker ref — the\n // marker-resolution step completes it by matching param name to a\n // component in the same file.\n const modTypeArgs = type.typeArguments.flatMap((t) => extractLiteralStrings(t));\n\n if (modTypeArgs.length > 0 && type.name) {\n return {\n filePath: '',\n exportName: '',\n modifiers: [{ name: type.name, typeArgs: modTypeArgs }]\n };\n }\n }\n\n return undefined;\n }\n\n case 'query': {\n if (type.queryType) {\n // eslint-disable-next-line unicorn/no-useless-recursion\n return resolveComponentRefDeep(\n type.queryType,\n idToReflection,\n idToPath,\n parsed\n );\n }\n\n return undefined;\n }\n\n case 'union':\n case 'intersection': {\n for (const t of type.types ?? []) {\n const inner = resolveComponentRefDeep(t, idToReflection, idToPath, parsed);\n\n if (inner) return inner;\n }\n\n return undefined;\n }\n\n case 'conditional': {\n return (\n resolveComponentRefDeep(type.trueType, idToReflection, idToPath, parsed) ??\n resolveComponentRefDeep(type.falseType, idToReflection, idToPath, parsed)\n );\n }\n\n default: {\n return undefined;\n }\n }\n}\n\n// ── Type-string helpers ────────────────────────────────────────\n\nfunction typeToString(type: TypeDocType | undefined): string {\n if (!type) return 'unknown';\n\n switch (type.type) {\n case 'intrinsic': {\n return type.name ?? 'unknown';\n }\n case 'reference': {\n return type.name ?? 'unknown';\n }\n case 'literal': {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string -- value is always a primitive from TypeDoc JSON\n return String(type.value);\n }\n case 'union': {\n return (type.types ?? []).map((t) => typeToString(t)).join(' | ');\n }\n case 'intersection': {\n return (type.types ?? []).map((t) => typeToString(t)).join(' & ');\n }\n case 'tuple': {\n return `[${(type.elements ?? []).map((t) => typeToString(t)).join(', ')}]`;\n }\n case 'array': {\n return `${typeToString(type.elementType)}[]`;\n }\n case 'reflection': {\n if (type.declaration?.signatures) {\n const sig = type.declaration.signatures[0];\n const params = (sig.parameters ?? [])\n .map((p) => `${p.name}: ${typeToString(p.type)}`)\n .join(', ');\n\n return `(${params}) => ${typeToString(sig.type)}`;\n }\n\n return 'object';\n }\n case 'conditional': {\n return `${typeToString(type.checkType)} extends ${typeToString(type.extendsType)} ? ${typeToString(type.trueType)} : ${typeToString(type.falseType)}`;\n }\n case 'indexedAccess': {\n return `${typeToString(type.objectType)}[${typeToString(type.indexType)}]`;\n }\n case 'inferred': {\n return `infer ${type.name}`;\n }\n case 'mapped': {\n return '{ [key: string]: unknown }';\n }\n case 'optional': {\n return `${typeToString(type.elementType)}?`;\n }\n case 'predicate': {\n return `${type.name} is ${typeToString(type.targetType)}`;\n }\n case 'query': {\n return `typeof ${type.queryType?.name}`;\n }\n case 'rest': {\n return `...${typeToString(type.elementType)}`;\n }\n case 'templateLiteral': {\n return (\n '`' +\n (type.head ?? '') +\n (type.tail?.map((t) => '${' + typeToString(t[0]) + '}' + t[1]).join('') ?? '') +\n '`'\n );\n }\n case 'typeOperator': {\n return `${type.operator} ${typeToString(type.target)}`;\n }\n\n default: {\n return 'unknown';\n }\n }\n}\n\nfunction extractTypeString(reflection: TypeDocReflection): string {\n if (reflection.signatures?.length) {\n const sig = reflection.signatures[0];\n const params = (sig.parameters ?? [])\n .map((p) => `${p.name}: ${typeToString(p.type)}`)\n .join(', ');\n\n return `(${params}) => ${typeToString(sig.type)}`;\n }\n\n if (!reflection.type) return 'unknown';\n\n return typeToString(reflection.type);\n}\n\nfunction typeToArgTypeInfo(type: TypeDocType | undefined): ArgTypeInfo {\n if (!type) return { category: 'other', raw: 'unknown' };\n\n switch (type.type) {\n case 'intrinsic': {\n const name: ArgTypeCategory = (type.name as ArgTypeCategory) ?? 'other';\n\n if (['string', 'number', 'boolean'].includes(name)) {\n return { category: name, raw: name };\n }\n\n return { category: 'other', raw: name };\n }\n\n case 'reference': {\n return { category: 'other', raw: type.name ?? 'unknown' };\n }\n\n case 'reflection': {\n if (type.declaration?.signatures?.length) {\n const raw = extractTypeString(type.declaration);\n\n return { category: 'function', raw };\n }\n\n if (type.declaration?.children?.length) {\n const props: Record<string, ArgTypeInfo> = {};\n\n for (const child of type.declaration.children) {\n if (child.kind === ReflectionKind.Property) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define -- hoisted\n props[child.name] = buildArgTypeInfo(child);\n }\n }\n\n return {\n category: 'object',\n raw: extractTypeString(type.declaration),\n properties: Object.keys(props).length > 0 ? props : undefined\n };\n }\n\n return { category: 'object', raw: typeToString(type) };\n }\n\n case 'union': {\n const literals = extractLiteralStrings(type);\n\n if (literals.length === (type.types ?? []).length && literals.length > 0) {\n return {\n category: 'enum',\n raw: typeToString(type),\n options: literals\n };\n }\n\n return { category: 'union', raw: typeToString(type) };\n }\n\n case 'array': {\n return {\n category: 'array',\n raw: typeToString(type),\n elementType: typeToArgTypeInfo(type.elementType)\n };\n }\n\n default: {\n return { category: 'other', raw: typeToString(type) };\n }\n }\n}\n\nfunction buildArgTypeInfo(reflection: TypeDocReflection): ArgTypeInfo {\n if (reflection.kind === ReflectionKind.Method) {\n return { category: 'function', raw: extractTypeString(reflection) };\n }\n\n if (!reflection.type) return { category: 'other', raw: 'unknown' };\n\n return typeToArgTypeInfo(reflection.type);\n}\n\n// ── Parse individual properties ────────────────────────────────\n\nfunction isArgSignature(reflection: TypeDocReflection): boolean {\n return reflection.kind === ReflectionKind.Property || reflection.kind === ReflectionKind.Method;\n}\n\nfunction parseArgsProperty(prop: TypeDocReflection): Record<string, ArgInfo> {\n const args: Record<string, ArgInfo> = {};\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (isArgSignature(child)) {\n args[child.name] = {\n type: buildArgTypeInfo(child),\n required: !isOptional(child),\n description: extractSummaryText(child.comment),\n defaultValue: extractDefaultValue(child)\n };\n }\n }\n\n return args;\n}\n\nfunction parseBlocksProperty(\n prop: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): Record<string, BlockInfo> {\n const blocks: Record<string, BlockInfo> = {};\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (isPropertySignature(child)) {\n const params: BlockInfo['params'] = [];\n const blockType = extractTypeReflection(child);\n\n if (blockType?.kind === ReflectionKind.TypeLiteral) {\n for (const param of blockType.children ?? []) {\n params.push({\n name: param.name,\n type: extractTypeString(param),\n description: extractSummaryText(param.comment),\n componentRef: resolveComponentRefDeep(param.type, idToReflection, idToPath, parsed)\n });\n }\n }\n\n if (child.type?.type === 'tuple') {\n for (const el of child.type.elements ?? []) {\n if (el.type === 'namedTupleMember') {\n params.push({\n name: el.name ?? '',\n type: typeToString(el.element),\n componentRef: resolveComponentRefDeep(el.element, idToReflection, idToPath, parsed)\n });\n } else if (\n el.type === 'reflection' &&\n el.declaration?.kind === ReflectionKind.TypeLiteral\n ) {\n // Yield hash: one name-keyed entry per named member\n const hash: HashBlockParam = {};\n\n for (const param of el.declaration.children ?? []) {\n hash[param.name] = {\n name: param.name,\n type: extractTypeString(param),\n description: extractSummaryText(param.comment),\n componentRef: resolveComponentRefDeep(\n param.type,\n idToReflection,\n idToPath,\n parsed\n )\n };\n }\n\n params.push(hash);\n } else {\n params.push({\n name: `param${params.length}`,\n type: typeToString(el),\n componentRef: resolveComponentRefDeep(el, idToReflection, idToPath, parsed)\n });\n }\n }\n }\n\n blocks[child.name] = {\n params,\n description: extractSummaryText(child.comment)\n };\n }\n }\n\n return blocks;\n}\n\nfunction parseElementProperty(prop: TypeDocReflection): string | undefined {\n const type = extractTypeString(prop);\n\n return type || undefined;\n}\n\nfunction parseStyleProperty(\n prop: TypeDocReflection\n): undefined | { customProperties: Record<string, string>; parts: Record<string, string> } {\n const result = {\n customProperties: {} as Record<string, string>,\n parts: {} as Record<string, string>\n };\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (child.name === 'CustomProperties') {\n const cpMembers =\n (child.type?.type === 'reflection' ? child.type.declaration?.children : undefined) ??\n child.children ??\n [];\n\n for (const cp of cpMembers) {\n if (isPropertySignature(cp)) {\n result.customProperties[cp.name] =\n extractStringLiteralValue(cp) ?? extractSummaryText(cp.comment);\n }\n }\n }\n\n if (child.name === 'Parts') {\n const partMembers =\n (child.type?.type === 'reflection' ? child.type.declaration?.children : undefined) ??\n child.children ??\n [];\n\n for (const part of partMembers) {\n if (isPropertySignature(part)) {\n result.parts[part.name] =\n extractStringLiteralValue(part) ?? extractSummaryText(part.comment);\n }\n }\n }\n }\n\n if (Object.keys(result.customProperties).length === 0 && Object.keys(result.parts).length === 0) {\n return undefined;\n }\n\n return result;\n}\n\nfunction assignProperty(\n child: TypeDocReflection,\n result: ComponentSignature,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n) {\n switch (child.name) {\n case 'Args': {\n result.args = parseArgsProperty(child);\n\n break;\n }\n\n case 'Blocks': {\n result.blocks = parseBlocksProperty(child, idToReflection, idToPath, parsed);\n\n break;\n }\n\n case 'Element': {\n result.element = parseElementProperty(child);\n\n break;\n }\n\n case 'Style': {\n const style = parseStyleProperty(child);\n\n if (style) {\n result.style = style;\n }\n\n break;\n }\n }\n}\n\nfunction parseSignatureProperty(\n prop: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignature {\n const result: ComponentSignature = {\n args: {},\n blocks: {},\n element: undefined,\n style: { customProperties: {}, parts: {} }\n };\n\n for (const child of prop.children ?? []) {\n assignProperty(child, result, idToReflection, idToPath, parsed);\n }\n\n return result;\n}\n\nfunction parseInterfaceSignature(\n reflection: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignature | undefined {\n const name = reflection.name;\n\n if (name !== 'Signature' && !name.endsWith('Signature')) {\n return undefined;\n }\n\n const children = reflection.children ?? [];\n const hasArgs = children.some((c) => c.name === 'Args');\n const hasBlocks = children.some((c) => c.name === 'Blocks');\n const hasElement = children.some((c) => c.name === 'Element');\n const hasStyle = children.some((c) => c.name === 'Style');\n\n if (!hasArgs && !hasBlocks && !hasElement && !hasStyle) {\n return undefined;\n }\n\n return parseSignatureProperty(reflection, idToReflection, idToPath, parsed);\n}\n\n// ── Extraction ─────────────────────────────────────────────────\n\nfunction recurseChildren(reflection: TypeDocReflection, fn: (r: TypeDocReflection) => void) {\n for (const child of reflection.children ?? []) {\n fn(child);\n recurseChildren(child, fn);\n }\n}\n\nfunction extractInterfaceSignatures(\n project: JSONOutput.ProjectReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>\n): Map<number, ParsedSignature> {\n const result = new Map<number, ParsedSignature>();\n\n function add(reflection: TypeDocReflection) {\n if (reflection.kind !== ReflectionKind.Interface) return;\n\n const sig = parseInterfaceSignature(reflection, idToReflection, idToPath, result);\n\n if (!sig) return;\n result.set(reflection.id, {\n sig,\n name: reflection.name,\n file: sourceFile(reflection)\n });\n }\n\n for (const child of project.children ?? []) {\n add(child);\n\n if (child.kind === ReflectionKind.Module || child.kind === ReflectionKind.Namespace) {\n recurseChildren(child, add);\n }\n }\n\n return result;\n}\n\n// ── Association ────────────────────────────────────────────────\n\nfunction deriveComponentName(reflection: TypeDocReflection): string {\n return reflection.name === 'default' ? Default : reflection.name;\n}\n\nfunction resolveSigId(\n type: TypeDocType | undefined,\n parsed: Map<number, ParsedSignature>\n): number | undefined {\n if (!type) return undefined;\n\n if (type.type === 'reference' && type.typeArguments) {\n for (const ta of type.typeArguments) {\n if (ta.type === 'reference') {\n // Numeric target — direct reflection ID\n if (typeof ta.target === 'number' && parsed.has(ta.target)) {\n return ta.target;\n }\n\n // Object target — external reference; look up by name\n if (typeof ta.target === 'object') {\n const qn = (ta.target as { qualifiedName?: string }).qualifiedName;\n\n if (qn) {\n for (const [id, entry] of parsed) {\n if (entry.name === qn) return id;\n }\n }\n }\n }\n }\n }\n\n return undefined;\n}\n\nfunction associateReflection(\n reflection: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>,\n signatures: ComponentSignatureMap\n) {\n if (reflection.variant === 'reference') return;\n\n // Must be a known Ember component\n if (!isEmberComponent(reflection.id, idToReflection, parsed)) return;\n\n let entry: ParsedSignature | undefined;\n\n // Class extends Component<Signature>\n if (reflection.kind === ReflectionKind.Class && reflection.extendedTypes) {\n for (const ext of reflection.extendedTypes) {\n const id = resolveSigId(ext, parsed);\n\n if (id !== undefined) {\n entry = parsed.get(id);\n if (entry) break;\n }\n }\n }\n\n // Variable typed as TOC<Signature>\n if (reflection.kind === ReflectionKind.Variable && !entry) {\n const id = resolveSigId(reflection.type, parsed);\n\n if (id !== undefined) {\n entry = parsed.get(id);\n }\n }\n\n if (entry) {\n const name = deriveComponentName(reflection);\n const copy = { ...entry.sig, componentName: name };\n const filePath = normalizeReflectionPath(sourceFile(reflection) ?? '');\n\n (signatures[filePath] ??= {})[name] = copy;\n\n return;\n }\n\n // File-based fallback: if isEmberComponent returned true via the fallback\n // (same-file *Signature interface), find it now.\n const file = sourceFile(reflection);\n\n if (!file) return;\n\n for (const candidate of parsed.values()) {\n if (candidate.file === file) {\n const copy = { ...candidate.sig, componentName: deriveComponentName(reflection) };\n const filePath = normalizeReflectionPath(file);\n\n (signatures[filePath] ??= {})[copy.componentName] = copy;\n\n return;\n }\n }\n}\n\nfunction associateComponents(\n project: JSONOutput.ProjectReflection,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignatureMap {\n const signatures: ComponentSignatureMap = {};\n\n function associate(reflection: TypeDocReflection) {\n associateReflection(reflection, idToReflection, parsed, signatures);\n }\n\n for (const child of project.children ?? []) {\n associate(child);\n recurseChildren(child, associate);\n }\n\n return signatures;\n}\n\n// ── Marker resolution ──────────────────────────────────────────\n\n/**\n * Complete marker componentRefs by matching block param names to component\n * signatures in the same file. Marker refs are created when TypeDoc resolves\n * typeof ComponentX to a Glint utility type (like Invokable) — the original\n * component reference is lost but the modifier chain is preserved. The\n * component lives in the same file, so filePath is the file's own map key.\n */\nfunction resolveMarkerRefs(signatures: ComponentSignatureMap): ComponentSignatureMap {\n for (const [filePath, compSigs] of Object.entries(signatures)) {\n const componentNames = Object.keys(compSigs);\n\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n const isResolvedComponentType = ['Invokable', 'TOC', 'ComponentLike'].includes(\n param.type\n );\n\n if (\n isResolvedComponentType &&\n (!param.componentRef || param.componentRef.filePath === '') &&\n componentNames.includes(param.name)\n ) {\n param.componentRef = {\n filePath,\n exportName: param.name,\n modifiers: param.componentRef?.modifiers\n };\n }\n }\n }\n }\n }\n\n return signatures;\n}\n\n// ── Modifier enrichment ────────────────────────────────────────\n\n/**\n * Recover WithBoundArgs/Omit/Pick wrappers from the source AST for block\n * params whose componentRef lost the wrapper structure in TypeDoc's output.\n * Requires real filesystem paths, resolved via the TypeDoc base directory.\n */\nfunction enrichBlockParamModifiers(\n signatures: ComponentSignatureMap,\n base: string | undefined\n): void {\n if (!base) return;\n\n for (const [relPath, compSigs] of Object.entries(signatures)) {\n const absKey = path.resolve(base, relPath);\n\n if (!existsSync(absKey)) continue;\n\n const modifiers = extractBlockParamModifiers(absKey);\n\n if (modifiers.length === 0) continue;\n\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n if (\n param.componentRef &&\n !(param.componentRef.modifiers && param.componentRef.modifiers.length > 0)\n ) {\n const mod = modifiers.find((m) => m.paramName === param.name);\n\n if (mod) {\n param.componentRef.modifiers = [{ name: mod.wrapperName, typeArgs: mod.boundKeys }];\n }\n }\n }\n }\n }\n }\n}\n\n// ── Public API ─────────────────────────────────────────────────\n\nexport function analyze(\n reflections: JSONOutput.ProjectReflection,\n opts?: DocgenOptions\n): ComponentSignatureMap {\n const { idToPath, idToReflection } = buildReflectionMaps(reflections);\n const parsed = extractInterfaceSignatures(reflections, idToReflection, idToPath);\n const signatures = associateComponents(reflections, idToReflection, parsed);\n\n resolveMarkerRefs(signatures);\n\n const base = resolveTsconfigBase(opts);\n\n enrichBlockParamModifiers(signatures, base);\n\n return signatures;\n}\n","import path from 'node:path';\n\nimport type { StoryFilePath } from './types';\n\nconst COMPONENT_RE = /\\.g[tj]s$/;\n\nexport const PROJECT_ROOT = process.cwd();\n\nexport { Default } from 'ember-docgen';\n\nexport type ExportedName = string;\n\nexport function normalizeFilePath(absPath: string): string {\n const relative = path.relative(PROJECT_ROOT, absPath);\n\n return './' + relative.replaceAll('\\\\', '/');\n}\n\nconst storyFiles = new Set<string>();\n\nconst listeners = new Set<(filePath: string) => void>();\n\nexport function addStoryFileListener(listener: (filePath: string) => void): () => void {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function registerStoryFile(filePath: string) {\n storyFiles.add(filePath);\n\n for (const listener of listeners) {\n listener(filePath);\n }\n}\n\nexport function getStoryFiles(): StoryFilePath[] {\n return [...storyFiles];\n}\n\nexport function isStoryFile(filePath: string): boolean {\n return storyFiles.has(filePath);\n}\n\nexport function isComponentFile(filePath: string): boolean {\n return COMPONENT_RE.test(filePath) && !isStoryFile(filePath);\n}\n","import { readFile } from 'node:fs/promises';\n\nimport { Preprocessor } from 'content-tag';\nimport { type CsfOptions, loadCsf } from 'storybook/internal/csf-tools';\n\nimport { registerStoryFile } from './shared';\n\nimport type { Indexer, IndexerOptions, IndexInput } from 'storybook/internal/types';\n\nfunction parse(fileName: string, code: string) {\n const preprocessor = new Preprocessor();\n\n return preprocessor.process(code, { filename: fileName });\n}\n\nexport const readCsf = async (fileName: string, options: CsfOptions) => {\n const code = await readFile(fileName, 'utf8');\n const result = parse(fileName, code);\n\n return loadCsf(result.code, { ...options, fileName });\n};\n\nexport const emberIndexer: Indexer = {\n test: /\\.stories\\.g[tj]s$/,\n\n createIndex: async (fileName: string, options: IndexerOptions): Promise<IndexInput[]> => {\n const rawCode = await readFile(fileName, 'utf8');\n const result = parse(fileName, rawCode);\n const csf = loadCsf(result.code, { ...options, fileName });\n const parsed = csf.parse();\n const inputs = parsed.indexInputs;\n\n registerStoryFile(fileName);\n\n return inputs;\n }\n};\n","import { readFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { Preprocessor } from 'content-tag';\nimport { parseSync, Visitor } from 'oxc-parser';\nimport { loadCsf, type StaticMeta, type StaticStory } from 'storybook/internal/csf-tools';\n\nimport { Default, type ExportedName, normalizeFilePath } from './shared';\n\nimport type { ExportSpecifier, Program, VariableDeclarator } from 'oxc-parser';\n\n/**\n * A map with contents of a component file:\n *\n * - `key`: The component name in the file\n * - `value`:\n * - `string`: The exported component name\n * - `undefined`: Not exported\n * - `Default`: default export\n */\nexport type ComponentMap = Record<ExportedName, string>;\n\nexport function readAndPreprocess(filePath: string): { rawCode: string; processedCode: string } {\n const rawCode = readFileSync(filePath, 'utf8');\n\n if (!filePath.endsWith('.gts') && !filePath.endsWith('.gjs')) {\n return { rawCode, processedCode: rawCode };\n }\n\n const pp = new Preprocessor();\n const result = pp.process(rawCode, { filename: filePath });\n\n return { rawCode, processedCode: result.code };\n}\n\nexport function parseProcessedCode(processedCode: string, filePath: string): Program {\n return parseSync(filePath, processedCode, {\n lang: filePath.endsWith('.gts') || filePath.endsWith('.ts') ? 'ts' : 'js',\n sourceType: 'module'\n }).program;\n}\n\n/**\n * Result of parsing a story file, covering all subsystem needs.\n */\nexport interface StoryFile {\n meta: StaticMeta;\n component: {\n /**\n * Project-relative path to the component file.\n * Set only when the component is imported from a local module.\n */\n file?: string;\n\n /**\n * The key to look up the component's signature in the component\n * file's signatures record. Matches TypeDoc's deriveComponentName.\n *\n * - `\"Greeting\"` for `export const Greeting = ...`\n * - `\"Card\"` for `export { Card as CardExport }`\n * - `\"Button\"` for `export default class Button ...`\n */\n signatureName?: string;\n\n /**\n * The name used to invoke the component in generated source.\n * Differs from `signatureName` for default exports, where the\n * signature is keyed by the `__DEFAULT__` sentinel but the real\n * component name (e.g. `\"Button\"`) is known from the component file.\n */\n name?: string;\n };\n\n stories: (StaticStory & { inlineTemplate?: string })[];\n}\n\n// ── Private helpers ────────────────────────────────────────────\n\nfunction firstVarExportName(declarations: VariableDeclarator[]): string | undefined {\n if (declarations.length === 0) return undefined;\n\n const first = declarations[0];\n\n if (first.id.type === 'Identifier') return first.id.name;\n\n return undefined;\n}\n\nfunction firstSpecExportName(specifiers: ExportSpecifier[]): string | undefined {\n if (specifiers.length === 0) return undefined;\n\n const first = specifiers[0];\n\n if (first.exported.type === 'Identifier') return first.exported.name;\n\n return undefined;\n}\n\nfunction firstSpecLocalName(specifiers: ExportSpecifier[]): string | undefined {\n if (specifiers.length === 0) return undefined;\n\n const first = specifiers[0];\n\n if (first.local.type === 'Identifier') return first.local.name;\n\n return undefined;\n}\n\n// ── Signature name resolution ──────────────────────────────────\n\nfunction findSignatureName(\n compMeta: ComponentMap | undefined,\n importedName: string | undefined\n): string | undefined {\n if (!compMeta) return undefined;\n if (importedName === Default) return Default;\n\n return importedName !== undefined && Object.hasOwn(compMeta, importedName)\n ? importedName\n : undefined;\n}\n\n// ── Public API ─────────────────────────────────────────────────\n\n/**\n * Parse a component file and return a map of all declarations.\n *\n * Each key is the internal variable/class name, each value is:\n * - `string` for named exports (the export name)\n * - `Default` for `export default`\n * - `undefined` for non-exported declarations\n */\nexport function parseComponentFile(compPath: string): ComponentMap | undefined {\n let program: Program;\n\n try {\n const { processedCode } = readAndPreprocess(compPath);\n\n program = parseProcessedCode(processedCode, compPath);\n } catch {\n return undefined;\n }\n\n const result: ComponentMap = {};\n const handled = new Set<string>();\n\n const visitor = new Visitor({\n ExportNamedDeclaration(node) {\n if (node.declaration?.type === 'VariableDeclaration') {\n const name = firstVarExportName(node.declaration.declarations);\n\n if (name && !handled.has(name)) {\n handled.add(name);\n result[name] = name;\n }\n }\n\n if (node.specifiers.length > 0) {\n const specExported = firstSpecExportName(node.specifiers);\n const specLocal = firstSpecLocalName(node.specifiers);\n\n if (specLocal && specExported) {\n handled.add(specLocal);\n result[specExported] = specLocal;\n } else if (specExported) {\n handled.add(specExported);\n result[specExported] = specExported;\n }\n }\n },\n\n VariableDeclaration(node) {\n const name = firstVarExportName(node.declarations);\n\n if (name && !handled.has(name)) {\n handled.add(name);\n // result[name] = undefined;\n }\n },\n\n ExportDefaultDeclaration(node) {\n const decl = node.declaration;\n\n let internalName: string | undefined;\n\n if (decl.type === 'ClassDeclaration' && decl.id?.type === 'Identifier') {\n internalName = decl.id.name;\n } else if (decl.type === 'Identifier') {\n internalName = decl.name;\n }\n\n if (internalName && !handled.has(internalName)) {\n handled.add(internalName);\n result[Default] = internalName;\n }\n }\n });\n\n visitor.visit(program);\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Parse a story file and return metadata about the component it references,\n * including template sources for each named story export.\n */\nexport function parseStoryFile(storyPath: string): StoryFile | undefined {\n const { processedCode } = readAndPreprocess(storyPath);\n\n // ── 1. CSF parsing — gives meta, story IDs, local names ──\n let meta: StaticMeta | undefined = {};\n let stories: (StaticStory & { inlineTemplate?: string })[] = [];\n\n try {\n const csf = loadCsf(processedCode, {\n fileName: storyPath,\n makeTitle: (userTitle: string | undefined) => userTitle ?? 'unknown'\n });\n const parsed = csf.parse();\n\n meta = parsed.meta;\n stories = parsed.stories;\n } catch {\n // CSF parsing failed — return partial result\n }\n\n // ── 2. Oxc walk — imports + inline templates ──\n const program = parseProcessedCode(processedCode, storyPath);\n const importMap = new Map<string, { source: string; importedName: string | undefined }>();\n const exportStack: ((StaticStory & { inlineTemplate?: string }) | undefined)[] = [];\n\n const visitor = new Visitor({\n ImportDeclaration(node) {\n for (const spec of node.specifiers) {\n const importedName =\n spec.type === 'ImportDefaultSpecifier'\n ? Default\n : spec.type === 'ImportSpecifier'\n ? spec.imported.type === 'Identifier'\n ? spec.imported.name\n : spec.imported.value\n : undefined;\n\n importMap.set(spec.local.name, { source: node.source.value, importedName });\n }\n },\n\n ExportNamedDeclaration(node) {\n if (node.declaration?.type !== 'VariableDeclaration') return;\n if (node.declaration.declarations.length === 0) return;\n\n const first = node.declaration.declarations[0];\n\n if (first.id.type !== 'Identifier') return;\n\n const name = (first.id as { name: string }).name;\n const story = stories.find((s) => (s.localName ?? s.name) === name);\n\n exportStack.push(story);\n },\n\n 'ExportNamedDeclaration:exit'() {\n exportStack.pop();\n },\n\n CallExpression(node) {\n const currentStory = exportStack.at(-1);\n\n if (!currentStory || currentStory.inlineTemplate) return;\n if (node.callee.type !== 'Identifier') return;\n if (!node.callee.name.startsWith('template_')) return;\n if (node.arguments.length === 0) return;\n\n const firstArg = node.arguments[0];\n\n if (firstArg.type !== 'TemplateLiteral') return;\n\n const raw = firstArg.quasis[0]?.value?.raw;\n\n if (raw) currentStory.inlineTemplate = raw;\n }\n });\n\n visitor.visit(program);\n\n // ── 3. Resolve component ──\n const localComponentName = meta.component;\n\n if (!localComponentName) {\n return { meta: meta, component: {}, stories };\n }\n\n const importInfo = importMap.get(localComponentName);\n\n if (!importInfo) {\n return {\n meta,\n component: { signatureName: localComponentName },\n stories\n };\n }\n\n const compPath = normalizeFilePath(path.resolve(path.dirname(storyPath), importInfo.source));\n const compMeta = parseComponentFile(compPath);\n const signatureName = findSignatureName(compMeta, importInfo.importedName);\n\n return {\n meta,\n component: {\n file: compPath,\n signatureName: signatureName ?? localComponentName,\n name: signatureName === Default ? (compMeta?.[Default] ?? localComponentName) : undefined\n },\n stories\n };\n}\n","import { addStoryFileListener, isComponentFile, normalizeFilePath } from './shared';\n\nimport type { HmrContext, Plugin, ViteDevServer } from 'vite';\n\nconst VIRTUAL = 'virtual:ember-storybook';\nconst RESOLVED = '\\0' + VIRTUAL;\n\nexport interface ContributorAPI {\n contribute(name: string, data: Record<string, unknown>): void;\n getContributions(): Map<string, Record<string, unknown>>;\n invalidate?: () => void;\n}\n\nexport function emberStorybookVitePlugin(api: ContributorAPI): Plugin {\n let server: ViteDevServer | undefined;\n\n function invalidate() {\n if (!server) return;\n\n const mod = server.moduleGraph.getModuleById(RESOLVED);\n\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n }\n\n server.ws.send({ type: 'full-reload' });\n }\n\n addStoryFileListener(() => {\n invalidate();\n });\n\n return {\n name: 'ember-storybook',\n\n resolveId(id) {\n if (id === VIRTUAL) return RESOLVED;\n },\n\n load(id) {\n if (id !== RESOLVED) return;\n\n const contributions = api.getContributions();\n const merged: Record<string, Record<string, unknown>> = {};\n\n for (const [name, data] of contributions) {\n for (const [filePath, value] of Object.entries(data)) {\n const relPath = normalizeFilePath(filePath);\n let normalizedValue = value;\n\n if (name === 'component' && typeof value === 'object' && value !== null) {\n const compValue = value as Record<string, string | undefined>;\n\n if (compValue.file) {\n normalizedValue = { ...compValue, file: normalizeFilePath(compValue.file) };\n }\n }\n\n (merged[relPath] ??= {})[name] = normalizedValue;\n }\n }\n\n return {\n code: `export default ${JSON.stringify(merged)};`,\n map: undefined\n };\n },\n\n handleHotUpdate(ctx: HmrContext) {\n // eslint-disable-next-line unicorn/prefer-early-return\n if (isComponentFile(ctx.file)) {\n const virtualMod = ctx.server.moduleGraph.getModuleById(RESOLVED);\n\n if (virtualMod) {\n ctx.server.moduleGraph.invalidateModule(virtualMod);\n }\n\n ctx.server.ws.send({ type: 'full-reload' });\n\n return [];\n }\n },\n\n configureServer(srv) {\n server = srv;\n api.invalidate = invalidate;\n }\n };\n}\n","import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { analyze, parseFile } from 'ember-docgen';\n\nimport { unwrapBlockParams } from '../../client/docs/block-params';\nimport { normalizeFilePath } from '../shared';\n\nimport type { ComponentSignatureMap } from 'ember-docgen';\n\n/**\n * Resolve the directory of the project's tsconfig, replicating TypeDoc's\n * discovery: walk up from cwd. parseFile pins TypeDoc's displayBasePath to\n * this directory, so analyze's JSON paths are relative to it.\n */\nfunction resolveTsconfigBase(): string | undefined {\n const findUp = (dir: string): string | undefined => {\n if (existsSync(path.join(dir, 'tsconfig.json'))) {\n return dir;\n }\n\n const parent = path.dirname(dir);\n\n return parent === dir ? undefined : findUp(parent);\n };\n\n return findUp(process.cwd());\n}\n\n/**\n * Rewrite componentRef.filePath from tsconfig-relative to project-root-relative\n * (`./`-prefixed) paths, so consumers can look signatures up in the meta map.\n */\nfunction rewriteFilePaths(mapped: ComponentSignatureMap, base: string): void {\n for (const compSigs of Object.values(mapped)) {\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n if (param.componentRef?.filePath) {\n param.componentRef.filePath = normalizeFilePath(\n path.resolve(base, param.componentRef.filePath)\n );\n }\n }\n }\n }\n }\n}\n\nexport async function runTypeDoc(entryPoints: string[]): Promise<ComponentSignatureMap> {\n if (entryPoints.length === 0) {\n return {};\n }\n\n const base = resolveTsconfigBase();\n\n if (!base) {\n return {};\n }\n\n try {\n // Component signatures, keyed by absolute entry-point paths.\n // Transitive subcomponents (not in the entry points) are included too.\n const mapped: ComponentSignatureMap = {};\n\n for (const file of entryPoints) {\n const json = await parseFile(file);\n const extracted = analyze(json);\n\n for (const [relPath, compSigs] of Object.entries(extracted)) {\n const absKey = path.resolve(base, relPath);\n\n mapped[absKey] ??= {};\n Object.assign(mapped[absKey], compSigs);\n }\n }\n\n rewriteFilePaths(mapped, base);\n\n return mapped;\n } catch (error) {\n console.warn('[ember-storybook] TypeDoc extraction failed:', error);\n\n return {};\n }\n}\n","import path from 'node:path';\n\nimport { parseStoryFile } from '../parser';\nimport { getStoryFiles, isComponentFile, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\nimport { runTypeDoc } from './docgen';\n\nimport type { ComponentSignatureMap } from 'ember-docgen';\nimport type { Plugin } from 'vite';\n\ninterface ComponentRef {\n componentName: string;\n componentPath: string;\n}\n\ninterface SignaturesState {\n storyToRef: Map<string, ComponentRef>;\n signatures: ComponentSignatureMap;\n}\n\nfunction isReferenced(state: SignaturesState, componentFile: string): boolean {\n const abs = path.resolve(componentFile);\n\n for (const r of state.storyToRef.values()) {\n if (r.componentPath === abs) return true;\n }\n\n return false;\n}\n\nfunction resolveComponentRef(storyFilePath: string): ComponentRef | undefined {\n const result = parseStoryFile(storyFilePath);\n\n if (!result?.component.file) return undefined;\n\n const componentPath = path.resolve(result.component.file);\n\n return { componentName: result.meta.component ?? '', componentPath };\n}\n\nasync function addSignatures(\n state: SignaturesState,\n componentPaths: string[]\n): Promise<SignaturesState> {\n const absPaths = componentPaths.map((cp) => path.resolve(cp));\n const missing = absPaths.filter((abs) => !Object.hasOwn(state.signatures, abs));\n\n if (missing.length === 0) return state;\n\n const newSigs = await runTypeDoc(missing);\n\n const merged = { ...state.signatures };\n\n for (const [filePath, compSigs] of Object.entries(newSigs)) {\n merged[filePath] = { ...merged[filePath], ...compSigs };\n }\n\n return { ...state, signatures: merged };\n}\n\nexport function signaturesContributor(api: ContributorAPI): Plugin {\n let state: SignaturesState = {\n storyToRef: new Map(),\n signatures: {}\n };\n\n function contributeState() {\n api.contribute('signatures', state.signatures);\n }\n\n function discoverAll() {\n const files = getStoryFiles();\n\n const next = new Map<string, ComponentRef>();\n\n for (const file of files) {\n const ref = resolveComponentRef(file);\n\n if (ref) {\n next.set(file, ref);\n }\n }\n\n state.storyToRef = next;\n }\n\n async function processStoryAdd(storyFile: string) {\n const ref = resolveComponentRef(storyFile);\n\n if (!ref) return;\n\n state.storyToRef.set(storyFile, ref);\n state = await addSignatures(state, [ref.componentPath]);\n contributeState();\n }\n\n function processStoryChange(storyFile: string) {\n state.storyToRef.delete(storyFile);\n\n const ref = resolveComponentRef(storyFile);\n\n if (ref) {\n state.storyToRef.set(storyFile, ref);\n }\n\n contributeState();\n }\n\n function processStoryUnlink(storyFile: string) {\n state.storyToRef.delete(storyFile);\n contributeState();\n }\n\n async function processComponentChange(componentFile: string) {\n const absFile = path.resolve(componentFile);\n\n if (!isReferenced(state, absFile)) return;\n\n const newSigs = await runTypeDoc([absFile]);\n const merged = { ...state.signatures };\n\n for (const [filePath, compSigs] of Object.entries(newSigs)) {\n merged[filePath] = { ...merged[filePath], ...compSigs };\n }\n\n state = { ...state, signatures: merged };\n contributeState();\n }\n\n return {\n name: 'ember-storybook:signatures',\n\n async buildStart() {\n discoverAll();\n\n const allPaths = [...new Set(Array.from(state.storyToRef.values(), (r) => r.componentPath))];\n\n state = await addSignatures(state, allPaths);\n contributeState();\n },\n\n configureServer(server) {\n server.watcher.on('add', (changedFile) => {\n if (isStoryFile(changedFile)) {\n void processStoryAdd(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n\n server.watcher.on('change', (changedFile) => {\n if (isStoryFile(changedFile)) {\n processStoryChange(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n\n server.watcher.on('unlink', (changedFile) => {\n if (isStoryFile(changedFile)) {\n processStoryUnlink(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n }\n };\n}\n","import { parseStoryFile } from '../parser';\nimport { getStoryFiles, isComponentFile, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\n\nimport type { StaticMeta } from 'storybook/internal/csf-tools';\nimport type { Plugin } from 'vite';\n\nexport interface ComponentMeta {\n file?: string;\n signatureName?: string;\n}\n\nfunction computeDataForStory(file: string): {\n meta: Record<string, StaticMeta>;\n component: Record<string, ComponentMeta>;\n} {\n const storyResult = parseStoryFile(file);\n\n if (!storyResult?.meta.component) {\n return { meta: {}, component: {} };\n }\n\n return {\n meta: { [file]: storyResult.meta },\n component: {\n [file]: {\n file: storyResult.component.file,\n signatureName: storyResult.component.signatureName\n }\n }\n };\n}\n\nexport function metaContributor(api: ContributorAPI): Plugin {\n let fileMeta: Record<string, StaticMeta> = {};\n let fileComponent: Record<string, ComponentMeta> = {};\n\n function recontribute() {\n api.contribute('meta', { ...fileMeta });\n api.contribute('component', { ...fileComponent });\n }\n\n function syncAll() {\n let meta: Record<string, StaticMeta> = {};\n let component: Record<string, ComponentMeta> = {};\n\n for (const file of getStoryFiles()) {\n const data = computeDataForStory(file);\n\n meta = { ...meta, ...data.meta };\n component = { ...component, ...data.component };\n }\n\n fileMeta = meta;\n fileComponent = component;\n recontribute();\n }\n\n function storiesForComponent(compPath: string): string[] {\n return Object.entries(fileComponent)\n .filter(([, v]) => v.file === compPath)\n .map(([k]) => k);\n }\n\n return {\n name: 'ember-storybook:meta',\n\n buildStart() {\n syncAll();\n },\n\n configureServer(server) {\n server.watcher.on('add', (changedPath) => {\n // eslint-disable-next-line unicorn/prefer-early-return\n if (isStoryFile(changedPath)) {\n const data = computeDataForStory(changedPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n recontribute();\n }\n });\n\n server.watcher.on('change', (changedPath) => {\n if (isStoryFile(changedPath)) {\n const data = computeDataForStory(changedPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n recontribute();\n } else if (isComponentFile(changedPath)) {\n for (const storyPath of storiesForComponent(changedPath)) {\n const data = computeDataForStory(storyPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n }\n\n recontribute();\n }\n });\n\n server.watcher.on('unlink', (changedPath) => {\n if (!(isStoryFile(changedPath) || isComponentFile(changedPath))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete fileMeta[changedPath];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete fileComponent[changedPath];\n recontribute();\n });\n }\n };\n}\n","import { parseStoryFile } from '../parser';\nimport { getStoryFiles, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\n\nimport type { StorySource } from '../types';\nimport type { Plugin } from 'vite';\n\nexport function sourceContributor(api: ContributorAPI): Plugin {\n let fileMeta: Record<string, Record<string, StorySource>> = {};\n\n function contribute() {\n api.contribute('source', { ...fileMeta });\n }\n\n function extractSource(filePath: string): Record<string, StorySource> {\n const result = parseStoryFile(filePath);\n const output: Record<string, StorySource> = {};\n\n for (const story of result?.stories ?? []) {\n output[story.id] = {\n inlineTemplate: story.inlineTemplate,\n componentName: result?.component.name ?? result?.component.signatureName,\n signatureName: result?.component.signatureName\n };\n }\n\n return output;\n }\n\n function refreshMeta(storyPath: string) {\n try {\n fileMeta[storyPath] = extractSource(storyPath);\n contribute();\n } catch {\n // file extraction failed\n }\n }\n\n return {\n name: 'ember-storybook:source',\n\n buildStart() {\n const files = getStoryFiles().filter((f) => isStoryFile(f));\n const data: Record<string, Record<string, StorySource>> = {};\n\n for (const file of files) {\n data[file] = extractSource(file);\n }\n\n fileMeta = data;\n contribute();\n },\n\n configureServer(server) {\n server.watcher.on('add', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n refreshMeta(storyPath);\n });\n\n server.watcher.on('change', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n refreshMeta(storyPath);\n });\n\n server.watcher.on('unlink', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n\n Reflect.deleteProperty(fileMeta, storyPath);\n contribute();\n });\n }\n };\n}\n","import { signaturesContributor } from './docgen/vite-plugin';\nimport { metaContributor } from './meta/vite-plugin';\nimport { sourceContributor } from './source/vite-plugin';\nimport { type ContributorAPI, emberStorybookVitePlugin } from './vite-plugin-orchestrator';\n\nimport type { Plugin } from 'vite';\n\nexport function emberStorybookPlugin(): Plugin[] {\n const contributions = new Map<string, Record<string, unknown>>();\n\n const api: ContributorAPI = {\n contribute(name, data) {\n contributions.set(name, data);\n api.invalidate?.();\n },\n getContributions: () => contributions\n };\n\n return [\n emberStorybookVitePlugin(api),\n metaContributor(api),\n sourceContributor(api),\n signaturesContributor(api)\n ];\n}\n","import { fileURLToPath } from 'node:url';\n\nimport { type StorybookConfigVite, withoutVitePlugins } from '@storybook/builder-vite';\n\nimport { emberIndexer } from './node/indexer';\nimport { emberStorybookPlugin } from './node/vite-plugin';\n\nimport type { StorybookConfig } from './types';\nimport type { PresetProperty } from 'storybook/internal/types';\nimport type { UserConfig } from 'vite';\n\nexport const previewAnnotations: PresetProperty<'previewAnnotations'> = async (\n // eslint-disable-next-line @typescript-eslint/default-param-last\n entries = [],\n options\n) => {\n const config = fileURLToPath(import.meta.resolve('ember-storybook/client/config'));\n const annotations = [...entries, config];\n\n const docsConfig = await options.presets.apply('docs', {}, options);\n const docsEnabled = Object.keys(docsConfig).length > 0;\n\n if (docsEnabled) {\n const docsConfigPath = fileURLToPath(import.meta.resolve('ember-storybook/client/docs/config'));\n\n annotations.push(docsConfigPath);\n }\n\n return annotations;\n};\n\nexport const viteFinal: StorybookConfigVite['viteFinal'] = async (config: UserConfig) => {\n const { mergeConfig } = await import('vite');\n\n config.plugins = await withoutVitePlugins(config.plugins, ['embroider-content-for']);\n\n return mergeConfig(config, {\n plugins: [...emberStorybookPlugin()],\n optimizeDeps: {\n exclude: ['object-inspect']\n },\n resolve: {\n dedupe: ['ember-source']\n }\n });\n};\n\nexport const experimental_indexers: StorybookConfig['experimental_indexers'] = (indexers) => {\n return [emberIndexer, ...(indexers ?? [])];\n};\n\nexport const core: PresetProperty<'core'> = async (config, options) => {\n const framework = await options.presets.apply('framework');\n\n return {\n ...config,\n builder: {\n name: import.meta.resolve('@storybook/builder-vite'),\n options:\n typeof framework === 'string'\n ? {}\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ((framework.options?.builder ?? {}) as object)\n }\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAMA,KAAK,IAAIC,aAAa;AAE5B,MAAMC,UAAU;AAChB,MAAMC,UAAU;AAChB,MAAMC,aAAa;AACnB,MAAMC,aAAa;AAEnB,SAAgBC,kBAAkBC,UAAkB;CAClD,OAAOL,QAAQM,KAAKD,QAAQ;AAC9B;AAEA,SAAgBE,kBAAkBF,UAAkB;CAClD,OAAOJ,QAAQK,KAAKD,QAAQ;AAC9B;AAEA,SAAgBG,kBAAgBH,UAAkB;CAChD,OAAOD,kBAAkBC,QAAQ,KAAKE,kBAAkBF,QAAQ;AAClE;AAEA,SAAgBI,8BAA8BJ,UAAkB;CAC9D,OAAOH,WAAWI,KAAKD,QAAQ;AACjC;AAEA,SAAgBK,8BAA8BL,UAAkB;CAC9D,OAAOF,WAAWG,KAAKD,QAAQ;AACjC;A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F,MAAMC,cAAc,CAAC,GAAGN,SAASE,MAAM;CAEvC,MAAMK,aAAa,MAAMN,QAAQO,QAAQC,MAAM,QAAQ,CAAC,GAAGR,OAAO;CAGlE,IAFoBU,OAAOC,KAAKL,UAAU,CAAC,CAACM,SAAS,GAEpC;EACf,MAAMC,iBAAiBnB,cAAcQ,OAAOC,KAAKC,QAAQ,oCAAoC,CAAC;EAE9FC,YAAYS,KAAKD,cAAc;CACjC;CAEA,OAAOR;AACT;AAEA,MAAaU,YAA8C,OAAOd,WAAuB;CACvF,MAAM,EAAEe,gBAAgB,MAAM,OAAO;CAErCf,OAAOgB,UAAU,MAAMtB,mBAAmBM,OAAOgB,SAAS,CAAC,uBAAuB,CAAC;CAEnF,OAAOD,YAAYf,QAAQ;EACzBgB,SAAS,CAAC,GAAGpB,qBAAqB,CAAC;EACnCqB,cAAc,EACZC,SAAS,CAAC,gBAAgB,EAC5B;EACAf,SAAS,EACPgB,QAAQ,CAAC,cAAc,EACzB;CACF,CAAC;AACH;AAEA,MAAaC,yBAAmEC,aAAa;CAC3F,OAAO,CAAC1B,cAAc,GAAI0B,YAAY,CAAA,CAAG;AAC3C;AAEA,MAAaC,OAA+B,OAAOtB,QAAQD,YAAY;CACrE,MAAMwB,YAAY,MAAMxB,QAAQO,QAAQC,MAAM,WAAW;CAEzD,OAAO;EACL,GAAGP;EACHwB,SAAS;GACPC,MAAMxB,OAAOC,KAAKC,QAAQ,yBAAyB;GACnDJ,SACE,OAAOwB,cAAc,WACjB,CAAC,IAECA,UAAUxB,SAASyB,WAAW,CAAC;EACzC;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"preset.mjs","names":["pp","Preprocessor","GTS_EXT","GJS_EXT","GTS_TS_EXT","GJS_TS_EXT","isEmberTSTemplate","fileName","test","isEmberJSTemplate","isEmberTemplate","isEmberTSTemplateWithAppendix","isEmberJSTemplateWithAppendix","isEmberTemplateWithAppendix","originalPath","virtualName","replace","virtualPath","original","processEmberTemplate","raw","readFileSync","process","filename","code","createEmberHost","host","_ts","gtsContentCache","Map","preprocess","cached","get","set","Proxy","target","prop","receiver","languageVersionOrOptions","onError","shouldCreateNewSourceFile","languageVersion","createSourceFile","getSourceFile","fileExists","readFile","Reflect","mapRootNames","rootNames","reverseMap","Array","from","map","name","v","require","createRequire","import","meta","url","patched","load","app","patchSys","origConvert","convert","bind","entryPoints","options","getValue","hasEmber","some","length","compilerOptions","getCompilerOptions","logger","createCompilerHost","ep","program","createProgram","manual","i","sf","displayName","basename","extname","sourceFile","filter","x","error","initializeRepositories","converter","origFileExists","sys","path","origReadFile","encoding","realPath","Default","ts","createRequire","import","meta","url","resolveTsconfigFile","opts","tsconfigFile","resolve","ts$1","findConfigFile","process","cwd","sys","fileExists","resolveTsconfigBase","file","dirname","isEmberTemplate","filePath","endsWith","bootstrapOptions","overrides","baseDir","typedocConfig","typedocConfigFile","options","tsconfig","displayBasePath","skipErrorChecking","excludePrivate","excludeProtected","runConversion","app","files","compilerOptions","getCompilerOptions","logger","host","createEmberHost","createCompilerHost","rootNames","map","program","createProgram","entryPoints","i","rootName","sourceFile","getSourceFile","displayName","basename","extname","filter","Boolean","length","Error","initializeRepositories","converter","convert","resolveEntryPoints","configured","getValue","getParsedCommandLineOfConfigFile","fileNames","expandEntryPoints","glob","absolute","expandDirectories","parseFile","Application","bootstrapWithPlugins","project","serializer","projectToObject","parseProject","readAndPreprocess","rawCode","readFileSync","Preprocessor","filename","code","isStringLiteralType","node","type","literal","String","value","collectStringLiterals","str","types","flatMap","t","extractModifierFromType","typeName","wrapperName","name","typeArgs","typeArguments","params","boundKeys","p","findNestedModifier","mod","param","inner","members","member","innerType","typeAnnotation","extractParamModifiersFromType","typeNode","modifiers","elementTypes","el","key","paramName","push","extractBlockParamModifiers","parseSync","lang","sourceType","Visitor","TSPropertySignature","visit","isPropertySignature","reflection","kind","ReflectionKind","Property","isOptional","flags","sources","fileName","extractSummaryText","comment","summary","text","join","extractDefaultValue","defaultValueTag","blockTags","find","tag","content","c","replace","trim","extractStringLiteralValue","extractTypeReflection","declaration","extractLiteralStrings","derivePackageName","packagePath","withoutNodeModules","parts","split","startsWith","slice","isBlockParam","Object","hasOwn","unwrapBlockParams","values","normalizeReflectionPath","buildReflectionMaps","idToPath","Map","idToReflection","walk","set","id","child","children","isEmberComponent","parsed","get","variant","Variable","Class","extendedTypes","ext","includes","candidate","resolveComponentRefDeep","target","resolved","exportName","packageName","qualifiedName","importPath","ta","nonComponentTypeArgs","m","modTypeArgs","queryType","trueType","falseType","typeToString","elements","elementType","signatures","sig","parameters","checkType","extendsType","objectType","indexType","targetType","head","tail","operator","extractTypeString","typeToArgTypeInfo","category","raw","props","buildArgTypeInfo","properties","keys","literals","Method","isArgSignature","parseArgsProperty","prop","args","required","description","defaultValue","parseBlocksProperty","blocks","blockType","TypeLiteral","componentRef","element","hash","parseElementProperty","parseStyleProperty","result","customProperties","cpMembers","cp","partMembers","part","assignProperty","style","parseSignatureProperty","parseInterfaceSignature","hasArgs","some","hasBlocks","hasElement","hasStyle","recurseChildren","fn","extractInterfaceSignatures","add","Interface","Module","Namespace","deriveComponentName","resolveSigId","has","qn","entry","associateReflection","copy","componentName","associateComponents","associate","resolveMarkerRefs","compSigs","entries","componentNames","compSig","blockInfo","enrichBlockParamModifiers","base","relPath","absKey","path","existsSync","analyze","reflections","path","COMPONENT_RE","PROJECT_ROOT","process","cwd","Default","normalizeFilePath","absPath","relative","replaceAll","storyFiles","Set","listeners","addStoryFileListener","listener","add","delete","registerStoryFile","filePath","getStoryFiles","isStoryFile","has","isComponentFile","test","readFile","Preprocessor","loadCsf","registerStoryFile","parse","fileName","code","preprocessor","process","filename","readCsf","options","result","emberIndexer","test","createIndex","rawCode","csf","parsed","inputs","indexInputs","readFileSync","path","Preprocessor","parseSync","Visitor","loadCsf","Default","normalizeFilePath","readAndPreprocess","filePath","rawCode","endsWith","processedCode","pp","result","process","filename","code","parseProcessedCode","lang","sourceType","program","firstVarExportName","declarations","length","undefined","first","id","type","name","firstSpecExportName","specifiers","exported","firstSpecLocalName","local","findSignatureName","compMeta","importedName","Object","hasOwn","parseComponentFile","compPath","handled","Set","visitor","ExportNamedDeclaration","node","declaration","has","add","specExported","specLocal","VariableDeclaration","ExportDefaultDeclaration","decl","internalName","visit","keys","parseStoryFile","storyPath","meta","stories","csf","fileName","makeTitle","userTitle","parsed","parse","importMap","Map","exportStack","ImportDeclaration","spec","imported","value","set","source","story","find","s","localName","push","ExportNamedDeclaration:exit","pop","CallExpression","currentStory","at","inlineTemplate","callee","startsWith","arguments","firstArg","raw","quasis","localComponentName","component","importInfo","get","signatureName","resolve","dirname","file","addStoryFileListener","isComponentFile","normalizeFilePath","VIRTUAL","RESOLVED","emberStorybookVitePlugin","api","server","invalidate","mod","moduleGraph","getModuleById","invalidateModule","ws","send","type","name","resolveId","id","load","contributions","getContributions","merged","data","filePath","value","Object","entries","relPath","normalizedValue","compValue","file","code","JSON","stringify","map","undefined","handleHotUpdate","ctx","virtualMod","configureServer","srv","existsSync","path","analyze","parseFile","unwrapBlockParams","normalizeFilePath","resolveTsconfigBase","findUp","dir","join","parent","dirname","undefined","process","cwd","rewriteFilePaths","mapped","base","compSigs","Object","values","compSig","blockInfo","blocks","param","params","componentRef","filePath","resolve","runTypeDoc","entryPoints","length","file","json","extracted","relPath","entries","absKey","assign","error","console","warn","path","parseStoryFile","getStoryFiles","isComponentFile","isStoryFile","runTypeDoc","isReferenced","state","componentFile","abs","resolve","r","storyToRef","values","componentPath","resolveComponentRef","storyFilePath","result","component","file","undefined","componentName","meta","addSignatures","componentPaths","absPaths","map","cp","missing","filter","Object","hasOwn","signatures","length","newSigs","merged","filePath","compSigs","entries","signaturesContributor","api","Map","contributeState","contribute","discoverAll","files","next","ref","set","processStoryAdd","storyFile","processStoryChange","delete","processStoryUnlink","processComponentChange","absFile","name","buildStart","allPaths","Set","Array","from","configureServer","server","watcher","on","changedFile","parseStoryFile","getStoryFiles","isComponentFile","isStoryFile","computeDataForStory","file","storyResult","meta","component","signatureName","metaContributor","api","fileMeta","fileComponent","recontribute","contribute","syncAll","data","storiesForComponent","compPath","Object","entries","filter","v","map","k","name","buildStart","configureServer","server","watcher","on","changedPath","storyPath","parseStoryFile","getStoryFiles","isStoryFile","sourceContributor","api","fileMeta","contribute","extractSource","filePath","result","output","story","stories","id","inlineTemplate","componentName","component","name","signatureName","refreshMeta","storyPath","buildStart","files","filter","f","data","file","configureServer","server","watcher","on","Reflect","deleteProperty","signaturesContributor","metaContributor","sourceContributor","emberStorybookVitePlugin","emberStorybookPlugin","contributions","Map","api","contribute","name","data","set","invalidate","getContributions","fileURLToPath","withoutVitePlugins","emberIndexer","emberStorybookPlugin","docsRendererPlugin","docsPreviewPatch","name","enforce","resolveId","source","includes","endsWith","previewAnnotations","entries","options","config","import","meta","resolve","annotations","docsConfig","presets","apply","docsEnabled","Object","keys","length","docsConfigPath","push","viteFinal","mergeConfig","plugins","optimizeDeps","exclude","dedupe","experimental_indexers","indexers","core","framework","builder"],"sources":["../../src/ember-host.ts","../../src/index.ts","../../src/types.ts","../../src/config.ts","../../src/parse.ts","../../src/parser.ts","../../src/signature-extractor.ts","../src/node/shared.ts","../src/node/indexer.ts","../src/node/parser.ts","../src/node/vite-plugin-orchestrator.ts","../src/node/docgen/docgen.ts","../src/node/docgen/vite-plugin.ts","../src/node/meta/vite-plugin.ts","../src/node/source/vite-plugin.ts","../src/node/vite-plugin.ts","../src/preset.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\n\nimport { Preprocessor } from 'content-tag';\n\nimport type ts from 'typescript';\n\nconst pp = new Preprocessor();\n\nconst GTS_EXT = /\\.gts$/;\nconst GJS_EXT = /\\.gjs$/;\nconst GTS_TS_EXT = /\\.gts\\.ts$/;\nconst GJS_TS_EXT = /\\.gjs\\.ts$/;\n\nexport function isEmberTSTemplate(fileName: string) {\n return GTS_EXT.test(fileName);\n}\n\nexport function isEmberJSTemplate(fileName: string) {\n return GJS_EXT.test(fileName);\n}\n\nexport function isEmberTemplate(fileName: string) {\n return isEmberTSTemplate(fileName) || isEmberJSTemplate(fileName);\n}\n\nexport function isEmberTSTemplateWithAppendix(fileName: string) {\n return GTS_TS_EXT.test(fileName);\n}\n\nexport function isEmberJSTemplateWithAppendix(fileName: string) {\n return GJS_TS_EXT.test(fileName);\n}\n\nexport function isEmberTemplateWithAppendix(fileName: string) {\n return isEmberTSTemplateWithAppendix(fileName) || isEmberJSTemplateWithAppendix(fileName);\n}\n\nexport function originalPath(virtualName: string) {\n return virtualName.replace(/\\.(gts|gjs)\\.ts$/, '.$1');\n}\n\nexport function virtualPath(original: string) {\n return original + '.ts';\n}\n\nexport function processEmberTemplate(fileName: string) {\n const raw = readFileSync(fileName, 'utf8');\n return pp.process(raw, { filename: fileName }).code;\n}\n\n/**\n * Wraps a TypeScript CompilerHost to handle .gts/.gjs files:\n *\n * - Virtual root names: `.gts` → `.gts.ts` so TypeScript includes them\n * - `getSourceFile`: preprocesses via content-tag, returns valid TS\n * - `fileExists`: recognizes both original and virtual paths\n * - `readFile`: serves preprocessed content for virtual paths\n */\nexport function createEmberHost(host: ts.CompilerHost, _ts: typeof ts): ts.CompilerHost {\n const gtsContentCache = new Map<string, string>();\n\n function preprocess(fileName: string): string {\n let cached = gtsContentCache.get(fileName);\n if (cached === undefined) {\n cached = processEmberTemplate(fileName);\n gtsContentCache.set(fileName, cached);\n }\n return cached;\n }\n\n return new Proxy(host, {\n get(target, prop, receiver) {\n // getSourceFile intercept: preprocess .gts/.gjs files\n if (prop === 'getSourceFile') {\n return (\n fileName: string,\n languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions,\n onError?: (message: string) => void,\n shouldCreateNewSourceFile?: boolean\n ) => {\n // Handle virtual .gts.ts files\n if (isEmberTemplateWithAppendix(fileName)) {\n const orig = originalPath(fileName);\n const code = preprocess(orig);\n const languageVersion =\n typeof languageVersionOrOptions === 'number'\n ? languageVersionOrOptions\n : languageVersionOrOptions.languageVersion;\n return _ts.createSourceFile(fileName, code, languageVersion);\n }\n\n // Handle direct .gts/.gjs files (for module resolution of imports)\n if (isEmberTemplate(fileName)) {\n const code = preprocess(fileName);\n const languageVersion =\n typeof languageVersionOrOptions === 'number'\n ? languageVersionOrOptions\n : languageVersionOrOptions.languageVersion;\n return _ts.createSourceFile(fileName, code, languageVersion);\n }\n\n return target.getSourceFile!(\n fileName,\n languageVersionOrOptions as ts.ScriptTarget,\n onError,\n shouldCreateNewSourceFile\n );\n };\n }\n\n if (prop === 'fileExists') {\n return (fileName: string) => {\n // Virtual .gts.ts → check original\n if (isEmberTemplateWithAppendix(fileName)) {\n return target.fileExists!(originalPath(fileName));\n }\n // .gts/.gjs files exist\n if (isEmberTemplate(fileName)) {\n return target.fileExists!(fileName);\n }\n return target.fileExists!(fileName);\n };\n }\n\n // readFile: serve preprocessed content for virtual/module resolution\n if (prop === 'readFile') {\n return (fileName: string) => {\n if (isEmberTemplateWithAppendix(fileName)) {\n return preprocess(originalPath(fileName));\n }\n if (isEmberTemplate(fileName)) {\n return preprocess(fileName);\n }\n return target.readFile!(fileName);\n };\n }\n\n return Reflect.get(target, prop, receiver);\n },\n });\n}\n\n/**\n * Maps root names so .gts/.gjs files are renamed to .gts.ts/.gjs.ts\n * so TypeScript includes them (it only processes .ts/.tsx/.js/.jsx).\n * Returns the new list + a reverse-map for the caller.\n */\nexport function mapRootNames(\n rootNames: readonly string[]\n): [string[], Map<string, string>] {\n const reverseMap = new Map<string, string>();\n\n const mapped = Array.from(rootNames).map((name) => {\n if (isEmberTSTemplate(name)) {\n const v = virtualPath(name);\n reverseMap.set(v, name);\n return v;\n }\n if (isEmberJSTemplate(name)) {\n const v = virtualPath(name);\n reverseMap.set(v, name);\n return v;\n }\n return name;\n });\n\n return [mapped, reverseMap];\n}\n","import { basename, extname } from 'node:path';\nimport { createRequire } from 'node:module';\n\nimport { Preprocessor } from 'content-tag';\nimport type { Application, DocumentationEntryPoint } from 'typedoc';\n\nexport { createEmberHost, mapRootNames, processEmberTemplate, isEmberTemplate, isEmberTemplateWithAppendix, originalPath, virtualPath } from './ember-host';\n\nimport { createEmberHost, isEmberTemplate, isEmberTemplateWithAppendix, originalPath, virtualPath } from './ember-host';\n\nconst require = createRequire(import.meta.url);\n\nlet patched = false;\n\nexport function load(app: Application) {\n if (!patched) {\n patched = true;\n patchSys();\n }\n\n // Override convert() to handle .gts/.gjs entry points via a manually\n // created TypeScript program, bypassing TypeDoc's expandGlobs (which\n // requires all files to exist on disk).\n const origConvert = app.convert.bind(app);\n app.convert = async () => {\n const entryPoints: string[] = app.options.getValue('entryPoints');\n const hasEmber = entryPoints.some(isEmberTemplate);\n\n if (!entryPoints.length || !hasEmber) {\n return origConvert();\n }\n\n const _ts = require('typescript') as typeof import('typescript');\n const compilerOptions = app.options.getCompilerOptions(app.logger);\n const host = createEmberHost(_ts.createCompilerHost(compilerOptions), _ts);\n\n const rootNames = entryPoints.map((ep) =>\n isEmberTemplate(ep) ? virtualPath(ep) : ep,\n );\n\n const program = _ts.createProgram({\n rootNames,\n options: compilerOptions,\n host,\n });\n\n const manual: DocumentationEntryPoint[] = entryPoints\n .map((ep, i) => {\n const sf = program.getSourceFile(rootNames[i]);\n if (!sf) return null;\n return {\n displayName: basename(ep, extname(ep)),\n sourceFile: sf,\n program,\n };\n })\n .filter((x): x is DocumentationEntryPoint => x !== null);\n\n if (!manual.length) {\n app.logger.error('No entry points could be resolved');\n return;\n }\n\n await app.initializeRepositories(manual);\n return app.converter.convert(manual);\n };\n}\n\nfunction patchSys() {\n let _ts: typeof import('typescript');\n\n try {\n _ts = require('typescript');\n } catch {\n return;\n }\n\n const pp = new Preprocessor();\n\n // Make ts.sys recognize virtual .gts.ts files by mapping file existence\n // and content reads to the real .gts/.gjs files on disk.\n const origFileExists = _ts.sys.fileExists.bind(_ts.sys);\n _ts.sys.fileExists = (path: string) => {\n if (isEmberTemplateWithAppendix(path)) {\n return origFileExists(originalPath(path));\n }\n return origFileExists(path);\n };\n\n const origReadFile = _ts.sys.readFile.bind(_ts.sys);\n _ts.sys.readFile = (path: string, encoding?: string) => {\n if (isEmberTemplateWithAppendix(path)) {\n const realPath = originalPath(path);\n const raw = origReadFile(realPath, encoding);\n if (raw != null) {\n return pp.process(raw, { filename: realPath }).code;\n }\n return raw;\n }\n return origReadFile(path, encoding);\n };\n}\n","import type { TypeDocOptions as TypeDocConfig } from 'typedoc';\n\nexport type ArgTypeCategory =\n | 'string'\n | 'number'\n | 'boolean'\n | 'function'\n | 'object'\n | 'array'\n | 'enum'\n | 'union'\n | 'symbol'\n | 'other';\n\nexport interface ArgTypeInfo {\n /** The semantic type category */\n category: ArgTypeCategory;\n /** Full type string for display (e.g. \"string\", \"(value: string) => void\", \"'small' | 'medium' | 'large'\") */\n raw: string;\n /** For 'enum': the literal option values */\n options?: string[];\n /** For 'array': the element type */\n elementType?: ArgTypeInfo;\n /** For 'object': known property names mapped to their types */\n properties?: Record<string, ArgTypeInfo>;\n}\n\nexport interface ArgInfo {\n type: ArgTypeInfo;\n required: boolean;\n description: string;\n defaultValue?: string;\n}\n\nexport interface ComponentSignature {\n args: Record<string, ArgInfo>;\n blocks: Record<string, BlockInfo>;\n element: string | undefined;\n style: {\n customProperties: Record<string, string>;\n parts: Record<string, string>;\n };\n}\n\nexport interface BlockParam {\n name: string;\n type: string;\n description?: string;\n componentRef?:\n | undefined\n | {\n filePath: string;\n exportName: string;\n importPath?: string;\n modifiers?: { name: string; typeArgs: string[] }[];\n };\n}\n\n/** A yield hash block param, keyed by the hash key (e.g. `{ Option: ... }`) */\nexport type HashBlockParam = Record<string, BlockParam>;\n\nexport interface BlockInfo {\n params: (BlockParam | HashBlockParam)[];\n description?: string;\n}\n\nexport type ComponentSignatureMap = Record<string, Record<string, ComponentSignature>>;\n\n/** Key used for default-export components */\nexport const Default = '__DEFAULT__';\n\n/**\n * Shared options for parseFile/parseProject/analyze.\n *\n * Precedence for typedoc settings:\n * inline `typedocConfig` > `typedocConfigFile` > TypeDoc default discovery.\n * `tsconfigFile` acts as the path anchor: parse pins TypeDoc's displayBasePath\n * to the tsconfig directory so JSON sources are relative to a base that\n * analyze() can re-derive from the same opts.\n */\nexport interface DocgenOptions {\n /** Path to tsconfig.json. If omitted, discovered walking up from cwd. */\n tsconfigFile?: string;\n /** Path to typedoc.json / typedoc.config.js. If omitted, TypeDoc discovers it. */\n typedocConfigFile?: string;\n /** Inline typedoc options, merged on top of typedocConfigFile / defaults. */\n typedocConfig?: Partial<TypeDocConfig>;\n}\n","import { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\n\n// eslint-disable-next-line import-x/default\nimport type TS from 'typescript';\n\nconst require = createRequire(import.meta.url);\nconst ts = require('typescript') as typeof TS;\n\nimport type { DocgenOptions } from './types';\n\n/**\n * Resolve the tsconfig file, replicating TypeDoc's discovery:\n * explicit `tsconfigFile` when given, else walk up from cwd.\n * Returns undefined when no tsconfig can be found.\n */\nexport function resolveTsconfigFile(opts?: DocgenOptions): string | undefined {\n if (opts?.tsconfigFile) {\n return resolve(opts.tsconfigFile);\n }\n\n return ts.findConfigFile(process.cwd(), ts.sys.fileExists) ?? undefined;\n}\n\n/**\n * The path anchor shared by parse and analyze.\n *\n * parse pins TypeDoc's displayBasePath to this directory so JSON\n * sources are relative to it; analyze re-derives it from the same opts.\n */\nexport function resolveTsconfigBase(opts?: DocgenOptions): string | undefined {\n const file = resolveTsconfigFile(opts);\n\n return file ? dirname(file) : undefined;\n}\n","import { createRequire } from 'node:module';\nimport { basename, extname } from 'node:path';\n\nimport { glob } from 'tinyglobby';\nimport { Application, type DocumentationEntryPoint, type ProjectReflection } from 'typedoc';\nimport { createEmberHost } from 'typedoc-plugin-ember';\n\nimport { resolveTsconfigBase, resolveTsconfigFile } from './config';\n\nimport type { DocgenOptions } from './types';\nimport type { JSONOutput, TypeDocOptions } from 'typedoc';\n\nconst require = createRequire(import.meta.url);\n// eslint-disable-next-line import-x/default\nimport type TS from 'typescript';\n\nconst ts = require('typescript') as typeof TS;\n\nfunction isEmberTemplate(filePath: string): boolean {\n return filePath.endsWith('.gts') || filePath.endsWith('.gjs');\n}\n\nfunction bootstrapOptions(\n opts: DocgenOptions | undefined,\n overrides: Partial<TypeDocOptions>\n): Partial<TypeDocOptions> {\n const baseDir = resolveTsconfigBase(opts);\n\n return {\n ...opts?.typedocConfig,\n ...(opts?.typedocConfigFile ? { options: opts.typedocConfigFile } : {}),\n tsconfig: resolveTsconfigFile(opts),\n ...(baseDir ? { displayBasePath: baseDir } : {}),\n skipErrorChecking: true,\n excludePrivate: false,\n excludeProtected: false,\n ...overrides\n };\n}\n\n/**\n * Shared pipeline: build the ember-aware TypeScript program and convert it.\n *\n * This is the manual .gts translation (createEmberHost + virtual .gts.ts\n * root names), not typedoc-plugin-ember's load() hook — that hook is broken\n * for glob-based entry points.\n */\nasync function runConversion(\n app: Application,\n files: string[]\n): Promise<ProjectReflection> {\n const compilerOptions = app.options.getCompilerOptions(app.logger);\n const host = createEmberHost(ts.createCompilerHost(compilerOptions), ts);\n\n const rootNames = files.map((file) => (isEmberTemplate(file) ? file + '.ts' : file));\n\n const program = ts.createProgram({\n rootNames,\n options: compilerOptions,\n host\n });\n\n const entryPoints = files\n .map((file, i) => {\n const rootName = rootNames[i];\n const sourceFile = program.getSourceFile(rootName);\n\n // eslint-disable-next-line unicorn/no-null\n if (!sourceFile) return null;\n\n return {\n displayName: basename(file, extname(file)),\n sourceFile,\n program\n };\n })\n .filter(Boolean) as DocumentationEntryPoint[];\n\n if (entryPoints.length === 0) {\n throw new Error('No entry points could be resolved');\n }\n\n await app.initializeRepositories(entryPoints);\n\n return app.converter.convert(entryPoints);\n}\n\nfunction resolveEntryPoints(\n app: Application,\n tsconfigFile: string | undefined\n): string[] {\n const configured = app.options.getValue('entryPoints') as string[];\n\n if (configured.length > 0) {\n return configured;\n }\n\n if (!tsconfigFile) return [];\n\n // Fall back to tsconfig include/files\n const parsed = ts.getParsedCommandLineOfConfigFile(\n tsconfigFile,\n {},\n ts.sys as never\n );\n\n return parsed?.fileNames ?? [];\n}\n\nasync function expandEntryPoints(entryPoints: string[]): Promise<string[]> {\n const files = await glob(entryPoints, {\n cwd: process.cwd(),\n absolute: true,\n expandDirectories: false\n });\n\n return files;\n}\n\n/**\n * Run typedoc on a single file and return the typedoc project JSON.\n */\nexport async function parseFile(\n file: string,\n opts?: DocgenOptions\n): Promise<JSONOutput.ProjectReflection> {\n const baseDir = resolveTsconfigBase(opts);\n\n const app = await Application.bootstrapWithPlugins(\n bootstrapOptions(opts, { entryPoints: [file] })\n );\n\n const project = await runConversion(app, [file]);\n\n return app.serializer.projectToObject(project, baseDir as never);\n}\n\n/**\n * Run typedoc on the project's entry points (from typedoc config,\n * falling back to tsconfig include/files) and return the JSON.\n */\nexport async function parseProject(\n opts?: DocgenOptions\n): Promise<JSONOutput.ProjectReflection> {\n const baseDir = resolveTsconfigBase(opts);\n\n const app = await Application.bootstrapWithPlugins(bootstrapOptions(opts, {}));\n\n const entryPoints = resolveEntryPoints(app, resolveTsconfigFile(opts));\n const files = await expandEntryPoints(entryPoints);\n\n if (files.length === 0) {\n throw new Error('No entry points could be resolved');\n }\n\n const project = await runConversion(app, files);\n\n return app.serializer.projectToObject(project, baseDir as never);\n}\n","import { readFileSync } from 'node:fs';\n\nimport { Preprocessor } from 'content-tag';\nimport { parseSync, Visitor } from 'oxc-parser';\n\nexport interface BlockParamModifier {\n paramName: string;\n wrapperName: string;\n boundKeys: string[];\n}\n\nfunction readAndPreprocess(filePath: string): string {\n const rawCode = readFileSync(filePath, 'utf8');\n\n if (!filePath.endsWith('.gts') && !filePath.endsWith('.gjs')) {\n return rawCode;\n }\n\n const pp = new Preprocessor();\n\n return pp.process(rawCode, { filename: filePath }).code;\n}\n\nfunction isStringLiteralType(node: Record<string, unknown>): string | undefined {\n if (node.type === 'TSLiteralType') {\n const literal = node.literal as Record<string, unknown> | undefined;\n\n if (literal?.type === 'Literal') {\n return String(literal.value);\n }\n }\n\n return undefined;\n}\n\nfunction collectStringLiterals(node: Record<string, unknown>): string[] {\n const str = isStringLiteralType(node);\n\n if (str !== undefined) return [str];\n\n if (node.type === 'TSUnionType') {\n const types = node.types as Record<string, unknown>[] | undefined;\n\n return (types ?? []).flatMap((t) => collectStringLiterals(t));\n }\n\n return [];\n}\n\nfunction extractModifierFromType(\n node: Record<string, unknown>\n): undefined | { wrapperName: string; boundKeys: string[] } {\n if (node.type !== 'TSTypeReference') return undefined;\n\n const typeName = node.typeName as Record<string, unknown> | undefined;\n\n if (typeName?.type !== 'Identifier') return undefined;\n\n const wrapperName = typeName.name as string;\n const typeArgs = node.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type !== 'TSTypeParameterInstantiation') return undefined;\n\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n if (!params || params.length === 0) return undefined;\n\n // Collect string literals from all type parameters\n const boundKeys = params.flatMap((p) => collectStringLiterals(p));\n\n if (boundKeys.length === 0) return undefined;\n\n return { wrapperName, boundKeys };\n}\n\n/**\n * Walk the type tree to find the first modifier (TSTypeReference with string\n * literal type arguments) nested anywhere inside the given type node.\n */\nfunction findNestedModifier(\n node: Record<string, unknown>\n): undefined | { wrapperName: string; boundKeys: string[] } {\n const mod = extractModifierFromType(node);\n\n if (mod) return mod;\n\n if (node.type === 'TSTypeReference') {\n const typeArgs = node.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type === 'TSTypeParameterInstantiation') {\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n for (const param of params ?? []) {\n const inner = findNestedModifier(param);\n\n if (inner) return inner;\n }\n }\n }\n\n if (node.type === 'TSIntersectionType' || node.type === 'TSUnionType') {\n const types = node.types as Record<string, unknown>[] | undefined;\n\n for (const t of types ?? []) {\n const inner = findNestedModifier(t);\n\n if (inner) return inner;\n }\n }\n\n if (node.type === 'TSTypeLiteral') {\n const members = node.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const ta = member.typeAnnotation as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (!innerType) continue;\n\n const inner = findNestedModifier(innerType);\n\n if (inner) return inner;\n }\n }\n }\n\n return undefined;\n}\n\nfunction extractParamModifiersFromType(\n typeNode: Record<string, unknown>,\n modifiers: BlockParamModifier[]\n): void {\n if (typeNode.type === 'TSTupleType') {\n const elementTypes = typeNode.elementTypes as Record<string, unknown>[] | undefined;\n\n for (const el of elementTypes ?? []) {\n if (el.type === 'TSTypeLiteral') {\n const members = el.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const key = member.key as Record<string, unknown> | undefined;\n const paramName = key?.type === 'Identifier' ? (key.name as string) : undefined;\n\n if (paramName) {\n const ta = member.typeAnnotation as Record<string, unknown> | undefined;\n const innerType = ta?.typeAnnotation as Record<string, unknown> | undefined;\n\n if (innerType) {\n const mod = extractModifierFromType(innerType) ?? findNestedModifier(innerType);\n\n if (mod) {\n modifiers.push({ paramName, ...mod });\n } else {\n extractParamModifiersFromType(innerType, modifiers);\n }\n }\n }\n }\n }\n }\n }\n }\n\n // TSTypeReference with type arguments — walk into them (e.g. ComponentLike<{...}>)\n if (typeNode.type === 'TSTypeReference') {\n const typeArgs = typeNode.typeArguments as Record<string, unknown> | undefined;\n\n if (typeArgs?.type === 'TSTypeParameterInstantiation') {\n const params = typeArgs.params as Record<string, unknown>[] | undefined;\n\n for (const param of params ?? []) {\n extractParamModifiersFromType(param, modifiers);\n }\n }\n }\n\n // Intersection types (e.g. Omit<...> & { kind?: ... })\n if (typeNode.type === 'TSIntersectionType') {\n const types = typeNode.types as Record<string, unknown>[] | undefined;\n\n for (const t of types ?? []) {\n extractParamModifiersFromType(t, modifiers);\n }\n }\n\n // Named block params: recurse into nested types to find tuple-based patterns.\n if (typeNode.type === 'TSTypeLiteral') {\n const members = typeNode.members as Record<string, unknown>[] | undefined;\n\n for (const member of members ?? []) {\n if (member.type === 'TSPropertySignature') {\n const ta = member.typeAnnotation as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (innerType) {\n extractParamModifiersFromType(innerType, modifiers);\n }\n }\n }\n }\n}\n\nexport function extractBlockParamModifiers(filePath: string): BlockParamModifier[] {\n const code = readAndPreprocess(filePath);\n\n const program = parseSync(filePath, code, {\n lang: filePath.endsWith('.gts') || filePath.endsWith('.ts') ? 'ts' : 'js',\n sourceType: 'module'\n }).program;\n\n const modifiers: BlockParamModifier[] = [];\n\n const visitor = new Visitor({\n TSPropertySignature(node) {\n const key = node.key as unknown as undefined | { type?: string; name?: string };\n\n if (key?.type !== 'Identifier') return;\n if (key.name !== 'Blocks') return;\n\n const ta = node.typeAnnotation as unknown as\n undefined | { typeAnnotation?: Record<string, unknown> };\n const innerType = ta?.typeAnnotation;\n\n if (!innerType) return;\n\n extractParamModifiersFromType(innerType, modifiers);\n }\n });\n\n visitor.visit(program);\n\n return modifiers;\n}\n","import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\n/* eslint-disable @typescript-eslint/no-unnecessary-condition --\n * JSONOutput types are strict discriminated unions, but the data comes\n * from deserialized JSON at runtime so every property is nullable. */\nimport { ReflectionKind } from 'typedoc';\n\nimport { extractBlockParamModifiers } from './parser';\nimport { resolveTsconfigBase } from './config';\nimport { Default } from './types';\n\nimport type {\n ArgInfo,\n ArgTypeCategory,\n ArgTypeInfo,\n BlockInfo,\n BlockParam,\n ComponentSignature,\n ComponentSignatureMap,\n DocgenOptions,\n HashBlockParam\n} from './types';\nimport type { JSONOutput } from 'typedoc';\n\n// ── Types ──────────────────────────────────────────────────────\n\ninterface ParsedSignature {\n sig: ComponentSignature;\n name: string;\n file: string | undefined;\n}\n\ntype ComponentRef = {\n filePath: string;\n exportName: string;\n importPath?: string;\n modifiers?: { name: string; typeArgs: string[] }[];\n};\n\ntype TypeDocReflection = JSONOutput.DeclarationReflection;\ntype TypeDocType = JSONOutput.SomeType;\n\n// ── Primitive helpers ──────────────────────────────────────────\n\nfunction isPropertySignature(reflection: TypeDocReflection): boolean {\n return reflection.kind === ReflectionKind.Property;\n}\n\nfunction isOptional(reflection: TypeDocReflection): boolean {\n return reflection.flags?.isOptional ?? false;\n}\n\nfunction sourceFile(reflection: TypeDocReflection): string | undefined {\n return reflection.sources?.[0]?.fileName;\n}\n\nfunction extractSummaryText(comment: JSONOutput.Comment | undefined): string {\n if (!comment?.summary) return '';\n\n return comment.summary\n .filter((p) => p.kind === 'text')\n .map((p) => p.text)\n .join(' ');\n}\n\nfunction extractDefaultValue(reflection: TypeDocReflection): string | undefined {\n const defaultValueTag = reflection.comment?.blockTags?.find(\n (t) => t.tag === '@default' || t.tag === '@defaultValue'\n );\n\n if (defaultValueTag) {\n const raw = defaultValueTag.content.map((c) => c.text).join(' ');\n\n return raw\n .replace(/^```\\w*\\s*/, '')\n .replace(/```$/, '')\n .trim();\n }\n\n return undefined;\n}\n\nfunction extractStringLiteralValue(reflection: TypeDocReflection): string | undefined {\n if (reflection.type?.type === 'literal' && typeof reflection.type.value === 'string') {\n return reflection.type.value;\n }\n\n return undefined;\n}\n\nfunction extractTypeReflection(reflection: TypeDocReflection): TypeDocReflection | undefined {\n if (reflection.type?.type === 'reflection' && reflection.type.declaration) {\n return reflection.type.declaration;\n }\n\n return undefined;\n}\n\nfunction extractLiteralStrings(type: TypeDocType): string[] {\n if (type.type === 'literal' && typeof type.value === 'string') return [type.value];\n if (type.type === 'union') return (type.types ?? []).flatMap((t) => extractLiteralStrings(t));\n\n return [];\n}\n\nfunction derivePackageName(packagePath: string): string {\n const withoutNodeModules = packagePath.replace(/^node_modules\\//, '');\n const parts = withoutNodeModules.split('/');\n\n // Scoped package: @scope/name\n if (parts[0]?.startsWith('@')) {\n return parts.slice(0, 2).join('/');\n }\n\n // Unscoped: package-name\n return parts[0] ?? withoutNodeModules;\n}\n\n// ── Block param helpers ────────────────────────────────────────\n\nfunction isBlockParam(param: BlockParam | HashBlockParam): param is BlockParam {\n return Object.hasOwn(param, 'name') && Object.hasOwn(param, 'type');\n}\n\n/** Flatten the params union into plain block params, unwrapping yield hashes. */\nexport function unwrapBlockParams(params: BlockInfo['params']): BlockParam[] {\n return params.flatMap((param) => (isBlockParam(param) ? [param] : Object.values(param)));\n}\n\n// ── Reflection map ─────────────────────────────────────────────\n\nfunction normalizeReflectionPath(fileName: string): string {\n return fileName.replace(/\\.(gts|gjs)\\.ts$/, '.$1');\n}\n\nfunction buildReflectionMaps(project: JSONOutput.ProjectReflection): {\n idToPath: Map<number, { filePath: string; name: string }>;\n idToReflection: Map<number, TypeDocReflection>;\n} {\n const idToPath = new Map<number, { filePath: string; name: string }>();\n const idToReflection = new Map<number, TypeDocReflection>();\n\n function walk(reflection: TypeDocReflection | JSONOutput.ProjectReflection) {\n idToReflection.set(reflection.id, reflection as never);\n\n if ('sources' in reflection && reflection.sources?.[0]?.fileName) {\n idToPath.set(reflection.id, {\n filePath: normalizeReflectionPath(reflection.sources[0].fileName),\n name: reflection.name === 'default' ? Default : reflection.name\n });\n }\n\n for (const child of reflection.children ?? []) {\n walk(child);\n }\n }\n\n walk(project);\n\n return { idToPath, idToReflection };\n}\n\nfunction isEmberComponent(\n id: number,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>\n): boolean {\n const reflection = idToReflection.get(id);\n\n if (!reflection) return false;\n if (reflection.variant === 'reference') return false;\n\n // Must be a class or variable\n if (reflection.kind !== ReflectionKind.Variable && reflection.kind !== ReflectionKind.Class) {\n return false;\n }\n\n // Class extends Component<Signature>\n if (reflection.kind === ReflectionKind.Class && reflection.extendedTypes) {\n for (const ext of reflection.extendedTypes) {\n if (ext.type === 'reference' && ext.name === 'Component') return true;\n }\n }\n\n // Variable typed as TOC<Signature> / ComponentLike<S> / Invokable<...>\n if (\n reflection.kind === ReflectionKind.Variable &&\n reflection.type?.type === 'reference' &&\n reflection.type.name &&\n ['TOC', 'ComponentLike', 'Invokable'].includes(reflection.type.name)\n ) {\n return true;\n }\n\n // Fallback: class/variable in a file with a *Signature interface\n const file = sourceFile(reflection);\n\n if (!file) return false;\n\n for (const candidate of parsed.values()) {\n if (candidate.file === file) return true;\n }\n\n return false;\n}\n\nfunction resolveComponentRefDeep(\n type: TypeDocType | undefined,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentRef | undefined {\n if (!type) return undefined;\n\n switch (type.type) {\n case 'reference': {\n // Numeric target — is it a known component?\n if (typeof type.target === 'number') {\n if (isEmberComponent(type.target, idToReflection, parsed)) {\n const resolved = idToPath.get(type.target);\n\n if (!resolved) return undefined;\n\n return {\n filePath: resolved.filePath,\n exportName: resolved.name\n };\n }\n\n return undefined;\n }\n\n // Object target — external package\n if (type.target && typeof type.target === 'object') {\n const { packageName, packagePath, qualifiedName } = type.target;\n\n // Skip known Glint utility types — they are base types that components\n // satisfy but are not components themselves. TypeDoc resolves typeof X\n // (where X extends Component) to Invokable, losing the original reference.\n const GLINT_UTILITY_TYPES = [\n 'Invokable',\n 'TOC',\n 'ComponentLike',\n 'HelperLike',\n 'ModifierLike'\n ];\n\n if (qualifiedName && GLINT_UTILITY_TYPES.includes(qualifiedName)) {\n return undefined;\n }\n\n if (packagePath && qualifiedName) {\n return {\n filePath: packagePath,\n exportName: qualifiedName,\n importPath: packageName ?? derivePackageName(packagePath)\n };\n }\n }\n\n // Reference with typeArguments — walk inside wrappers\n if (type.typeArguments) {\n // We need to find which type argument leads to a component.\n // Try each; the first that resolves is the component, the rest are modifier metadata.\n for (const ta of type.typeArguments) {\n const inner = resolveComponentRefDeep(ta, idToReflection, idToPath, parsed);\n\n if (inner) {\n // Collect non-component type arguments as modifier metadata\n const nonComponentTypeArgs = type.typeArguments.flatMap((t) =>\n t === ta ? [] : extractLiteralStrings(t)\n );\n\n const m: { name: string; typeArgs: string[] } = {\n name: type.name ?? '',\n typeArgs: nonComponentTypeArgs\n };\n\n return {\n ...inner,\n modifiers: [...(inner.modifiers ?? []), m]\n };\n }\n }\n\n // No component found in any type argument. This happens when\n // TypeDoc resolves typeof ComponentX to a Glint utility type\n // (like Invokable) which we skip. The wrapper still has modifier\n // info (string literal type args). Return a marker ref — the\n // marker-resolution step completes it by matching param name to a\n // component in the same file.\n const modTypeArgs = type.typeArguments.flatMap((t) => extractLiteralStrings(t));\n\n if (modTypeArgs.length > 0 && type.name) {\n return {\n filePath: '',\n exportName: '',\n modifiers: [{ name: type.name, typeArgs: modTypeArgs }]\n };\n }\n }\n\n return undefined;\n }\n\n case 'query': {\n if (type.queryType) {\n // eslint-disable-next-line unicorn/no-useless-recursion\n return resolveComponentRefDeep(\n type.queryType,\n idToReflection,\n idToPath,\n parsed\n );\n }\n\n return undefined;\n }\n\n case 'union':\n case 'intersection': {\n for (const t of type.types ?? []) {\n const inner = resolveComponentRefDeep(t, idToReflection, idToPath, parsed);\n\n if (inner) return inner;\n }\n\n return undefined;\n }\n\n case 'conditional': {\n return (\n resolveComponentRefDeep(type.trueType, idToReflection, idToPath, parsed) ??\n resolveComponentRefDeep(type.falseType, idToReflection, idToPath, parsed)\n );\n }\n\n default: {\n return undefined;\n }\n }\n}\n\n// ── Type-string helpers ────────────────────────────────────────\n\nfunction typeToString(type: TypeDocType | undefined): string {\n if (!type) return 'unknown';\n\n switch (type.type) {\n case 'intrinsic': {\n return type.name ?? 'unknown';\n }\n case 'reference': {\n return type.name ?? 'unknown';\n }\n case 'literal': {\n // eslint-disable-next-line @typescript-eslint/no-base-to-string -- value is always a primitive from TypeDoc JSON\n return String(type.value);\n }\n case 'union': {\n return (type.types ?? []).map((t) => typeToString(t)).join(' | ');\n }\n case 'intersection': {\n return (type.types ?? []).map((t) => typeToString(t)).join(' & ');\n }\n case 'tuple': {\n return `[${(type.elements ?? []).map((t) => typeToString(t)).join(', ')}]`;\n }\n case 'array': {\n return `${typeToString(type.elementType)}[]`;\n }\n case 'reflection': {\n if (type.declaration?.signatures) {\n const sig = type.declaration.signatures[0];\n const params = (sig.parameters ?? [])\n .map((p) => `${p.name}: ${typeToString(p.type)}`)\n .join(', ');\n\n return `(${params}) => ${typeToString(sig.type)}`;\n }\n\n return 'object';\n }\n case 'conditional': {\n return `${typeToString(type.checkType)} extends ${typeToString(type.extendsType)} ? ${typeToString(type.trueType)} : ${typeToString(type.falseType)}`;\n }\n case 'indexedAccess': {\n return `${typeToString(type.objectType)}[${typeToString(type.indexType)}]`;\n }\n case 'inferred': {\n return `infer ${type.name}`;\n }\n case 'mapped': {\n return '{ [key: string]: unknown }';\n }\n case 'optional': {\n return `${typeToString(type.elementType)}?`;\n }\n case 'predicate': {\n return `${type.name} is ${typeToString(type.targetType)}`;\n }\n case 'query': {\n return `typeof ${type.queryType?.name}`;\n }\n case 'rest': {\n return `...${typeToString(type.elementType)}`;\n }\n case 'templateLiteral': {\n return (\n '`' +\n (type.head ?? '') +\n (type.tail?.map((t) => '${' + typeToString(t[0]) + '}' + t[1]).join('') ?? '') +\n '`'\n );\n }\n case 'typeOperator': {\n return `${type.operator} ${typeToString(type.target)}`;\n }\n\n default: {\n return 'unknown';\n }\n }\n}\n\nfunction extractTypeString(reflection: TypeDocReflection): string {\n if (reflection.signatures?.length) {\n const sig = reflection.signatures[0];\n const params = (sig.parameters ?? [])\n .map((p) => `${p.name}: ${typeToString(p.type)}`)\n .join(', ');\n\n return `(${params}) => ${typeToString(sig.type)}`;\n }\n\n if (!reflection.type) return 'unknown';\n\n return typeToString(reflection.type);\n}\n\nfunction typeToArgTypeInfo(type: TypeDocType | undefined): ArgTypeInfo {\n if (!type) return { category: 'other', raw: 'unknown' };\n\n switch (type.type) {\n case 'intrinsic': {\n const name: ArgTypeCategory = (type.name as ArgTypeCategory) ?? 'other';\n\n if (['string', 'number', 'boolean'].includes(name)) {\n return { category: name, raw: name };\n }\n\n return { category: 'other', raw: name };\n }\n\n case 'reference': {\n return { category: 'other', raw: type.name ?? 'unknown' };\n }\n\n case 'reflection': {\n if (type.declaration?.signatures?.length) {\n const raw = extractTypeString(type.declaration);\n\n return { category: 'function', raw };\n }\n\n if (type.declaration?.children?.length) {\n const props: Record<string, ArgTypeInfo> = {};\n\n for (const child of type.declaration.children) {\n if (child.kind === ReflectionKind.Property) {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define -- hoisted\n props[child.name] = buildArgTypeInfo(child);\n }\n }\n\n return {\n category: 'object',\n raw: extractTypeString(type.declaration),\n properties: Object.keys(props).length > 0 ? props : undefined\n };\n }\n\n return { category: 'object', raw: typeToString(type) };\n }\n\n case 'union': {\n const literals = extractLiteralStrings(type);\n\n if (literals.length === (type.types ?? []).length && literals.length > 0) {\n return {\n category: 'enum',\n raw: typeToString(type),\n options: literals\n };\n }\n\n return { category: 'union', raw: typeToString(type) };\n }\n\n case 'array': {\n return {\n category: 'array',\n raw: typeToString(type),\n elementType: typeToArgTypeInfo(type.elementType)\n };\n }\n\n default: {\n return { category: 'other', raw: typeToString(type) };\n }\n }\n}\n\nfunction buildArgTypeInfo(reflection: TypeDocReflection): ArgTypeInfo {\n if (reflection.kind === ReflectionKind.Method) {\n return { category: 'function', raw: extractTypeString(reflection) };\n }\n\n if (!reflection.type) return { category: 'other', raw: 'unknown' };\n\n return typeToArgTypeInfo(reflection.type);\n}\n\n// ── Parse individual properties ────────────────────────────────\n\nfunction isArgSignature(reflection: TypeDocReflection): boolean {\n return reflection.kind === ReflectionKind.Property || reflection.kind === ReflectionKind.Method;\n}\n\nfunction parseArgsProperty(prop: TypeDocReflection): Record<string, ArgInfo> {\n const args: Record<string, ArgInfo> = {};\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (isArgSignature(child)) {\n args[child.name] = {\n type: buildArgTypeInfo(child),\n required: !isOptional(child),\n description: extractSummaryText(child.comment),\n defaultValue: extractDefaultValue(child)\n };\n }\n }\n\n return args;\n}\n\nfunction parseBlocksProperty(\n prop: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): Record<string, BlockInfo> {\n const blocks: Record<string, BlockInfo> = {};\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (isPropertySignature(child)) {\n const params: BlockInfo['params'] = [];\n const blockType = extractTypeReflection(child);\n\n if (blockType?.kind === ReflectionKind.TypeLiteral) {\n for (const param of blockType.children ?? []) {\n params.push({\n name: param.name,\n type: extractTypeString(param),\n description: extractSummaryText(param.comment),\n componentRef: resolveComponentRefDeep(param.type, idToReflection, idToPath, parsed)\n });\n }\n }\n\n if (child.type?.type === 'tuple') {\n for (const el of child.type.elements ?? []) {\n if (el.type === 'namedTupleMember') {\n params.push({\n name: el.name ?? '',\n type: typeToString(el.element),\n componentRef: resolveComponentRefDeep(el.element, idToReflection, idToPath, parsed)\n });\n } else if (\n el.type === 'reflection' &&\n el.declaration?.kind === ReflectionKind.TypeLiteral\n ) {\n // Yield hash: one name-keyed entry per named member\n const hash: HashBlockParam = {};\n\n for (const param of el.declaration.children ?? []) {\n hash[param.name] = {\n name: param.name,\n type: extractTypeString(param),\n description: extractSummaryText(param.comment),\n componentRef: resolveComponentRefDeep(\n param.type,\n idToReflection,\n idToPath,\n parsed\n )\n };\n }\n\n params.push(hash);\n } else {\n params.push({\n name: `param${params.length}`,\n type: typeToString(el),\n componentRef: resolveComponentRefDeep(el, idToReflection, idToPath, parsed)\n });\n }\n }\n }\n\n blocks[child.name] = {\n params,\n description: extractSummaryText(child.comment)\n };\n }\n }\n\n return blocks;\n}\n\nfunction parseElementProperty(prop: TypeDocReflection): string | undefined {\n const type = extractTypeString(prop);\n\n return type || undefined;\n}\n\nfunction parseStyleProperty(\n prop: TypeDocReflection\n): undefined | { customProperties: Record<string, string>; parts: Record<string, string> } {\n const result = {\n customProperties: {} as Record<string, string>,\n parts: {} as Record<string, string>\n };\n\n const members =\n (prop.type?.type === 'reflection' ? prop.type.declaration?.children : undefined) ??\n prop.children ??\n [];\n\n for (const child of members) {\n if (child.name === 'CustomProperties') {\n const cpMembers =\n (child.type?.type === 'reflection' ? child.type.declaration?.children : undefined) ??\n child.children ??\n [];\n\n for (const cp of cpMembers) {\n if (isPropertySignature(cp)) {\n result.customProperties[cp.name] =\n extractStringLiteralValue(cp) ?? extractSummaryText(cp.comment);\n }\n }\n }\n\n if (child.name === 'Parts') {\n const partMembers =\n (child.type?.type === 'reflection' ? child.type.declaration?.children : undefined) ??\n child.children ??\n [];\n\n for (const part of partMembers) {\n if (isPropertySignature(part)) {\n result.parts[part.name] =\n extractStringLiteralValue(part) ?? extractSummaryText(part.comment);\n }\n }\n }\n }\n\n if (Object.keys(result.customProperties).length === 0 && Object.keys(result.parts).length === 0) {\n return undefined;\n }\n\n return result;\n}\n\nfunction assignProperty(\n child: TypeDocReflection,\n result: ComponentSignature,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n) {\n switch (child.name) {\n case 'Args': {\n result.args = parseArgsProperty(child);\n\n break;\n }\n\n case 'Blocks': {\n result.blocks = parseBlocksProperty(child, idToReflection, idToPath, parsed);\n\n break;\n }\n\n case 'Element': {\n result.element = parseElementProperty(child);\n\n break;\n }\n\n case 'Style': {\n const style = parseStyleProperty(child);\n\n if (style) {\n result.style = style;\n }\n\n break;\n }\n }\n}\n\nfunction parseSignatureProperty(\n prop: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignature {\n const result: ComponentSignature = {\n args: {},\n blocks: {},\n element: undefined,\n style: { customProperties: {}, parts: {} }\n };\n\n for (const child of prop.children ?? []) {\n assignProperty(child, result, idToReflection, idToPath, parsed);\n }\n\n return result;\n}\n\nfunction parseInterfaceSignature(\n reflection: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignature | undefined {\n const name = reflection.name;\n\n if (name !== 'Signature' && !name.endsWith('Signature')) {\n return undefined;\n }\n\n const children = reflection.children ?? [];\n const hasArgs = children.some((c) => c.name === 'Args');\n const hasBlocks = children.some((c) => c.name === 'Blocks');\n const hasElement = children.some((c) => c.name === 'Element');\n const hasStyle = children.some((c) => c.name === 'Style');\n\n if (!hasArgs && !hasBlocks && !hasElement && !hasStyle) {\n return undefined;\n }\n\n return parseSignatureProperty(reflection, idToReflection, idToPath, parsed);\n}\n\n// ── Extraction ─────────────────────────────────────────────────\n\nfunction recurseChildren(reflection: TypeDocReflection, fn: (r: TypeDocReflection) => void) {\n for (const child of reflection.children ?? []) {\n fn(child);\n recurseChildren(child, fn);\n }\n}\n\nfunction extractInterfaceSignatures(\n project: JSONOutput.ProjectReflection,\n idToReflection: Map<number, TypeDocReflection>,\n idToPath: Map<number, { filePath: string; name: string }>\n): Map<number, ParsedSignature> {\n const result = new Map<number, ParsedSignature>();\n\n function add(reflection: TypeDocReflection) {\n if (reflection.kind !== ReflectionKind.Interface) return;\n\n const sig = parseInterfaceSignature(reflection, idToReflection, idToPath, result);\n\n if (!sig) return;\n result.set(reflection.id, {\n sig,\n name: reflection.name,\n file: sourceFile(reflection)\n });\n }\n\n for (const child of project.children ?? []) {\n add(child);\n\n if (child.kind === ReflectionKind.Module || child.kind === ReflectionKind.Namespace) {\n recurseChildren(child, add);\n }\n }\n\n return result;\n}\n\n// ── Association ────────────────────────────────────────────────\n\nfunction deriveComponentName(reflection: TypeDocReflection): string {\n return reflection.name === 'default' ? Default : reflection.name;\n}\n\nfunction resolveSigId(\n type: TypeDocType | undefined,\n parsed: Map<number, ParsedSignature>\n): number | undefined {\n if (!type) return undefined;\n\n if (type.type === 'reference' && type.typeArguments) {\n for (const ta of type.typeArguments) {\n if (ta.type === 'reference') {\n // Numeric target — direct reflection ID\n if (typeof ta.target === 'number' && parsed.has(ta.target)) {\n return ta.target;\n }\n\n // Object target — external reference; look up by name\n if (typeof ta.target === 'object') {\n const qn = (ta.target as { qualifiedName?: string }).qualifiedName;\n\n if (qn) {\n for (const [id, entry] of parsed) {\n if (entry.name === qn) return id;\n }\n }\n }\n }\n }\n }\n\n return undefined;\n}\n\nfunction associateReflection(\n reflection: TypeDocReflection,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>,\n signatures: ComponentSignatureMap\n) {\n if (reflection.variant === 'reference') return;\n\n // Must be a known Ember component\n if (!isEmberComponent(reflection.id, idToReflection, parsed)) return;\n\n let entry: ParsedSignature | undefined;\n\n // Class extends Component<Signature>\n if (reflection.kind === ReflectionKind.Class && reflection.extendedTypes) {\n for (const ext of reflection.extendedTypes) {\n const id = resolveSigId(ext, parsed);\n\n if (id !== undefined) {\n entry = parsed.get(id);\n if (entry) break;\n }\n }\n }\n\n // Variable typed as TOC<Signature>\n if (reflection.kind === ReflectionKind.Variable && !entry) {\n const id = resolveSigId(reflection.type, parsed);\n\n if (id !== undefined) {\n entry = parsed.get(id);\n }\n }\n\n if (entry) {\n const name = deriveComponentName(reflection);\n const copy = { ...entry.sig, componentName: name };\n const filePath = normalizeReflectionPath(sourceFile(reflection) ?? '');\n\n (signatures[filePath] ??= {})[name] = copy;\n\n return;\n }\n\n // File-based fallback: if isEmberComponent returned true via the fallback\n // (same-file *Signature interface), find it now.\n const file = sourceFile(reflection);\n\n if (!file) return;\n\n for (const candidate of parsed.values()) {\n if (candidate.file === file) {\n const copy = { ...candidate.sig, componentName: deriveComponentName(reflection) };\n const filePath = normalizeReflectionPath(file);\n\n (signatures[filePath] ??= {})[copy.componentName] = copy;\n\n return;\n }\n }\n}\n\nfunction associateComponents(\n project: JSONOutput.ProjectReflection,\n idToReflection: Map<number, TypeDocReflection>,\n parsed: Map<number, ParsedSignature>\n): ComponentSignatureMap {\n const signatures: ComponentSignatureMap = {};\n\n function associate(reflection: TypeDocReflection) {\n associateReflection(reflection, idToReflection, parsed, signatures);\n }\n\n for (const child of project.children ?? []) {\n associate(child);\n recurseChildren(child, associate);\n }\n\n return signatures;\n}\n\n// ── Marker resolution ──────────────────────────────────────────\n\n/**\n * Complete marker componentRefs by matching block param names to component\n * signatures in the same file. Marker refs are created when TypeDoc resolves\n * typeof ComponentX to a Glint utility type (like Invokable) — the original\n * component reference is lost but the modifier chain is preserved. The\n * component lives in the same file, so filePath is the file's own map key.\n */\nfunction resolveMarkerRefs(signatures: ComponentSignatureMap): ComponentSignatureMap {\n for (const [filePath, compSigs] of Object.entries(signatures)) {\n const componentNames = Object.keys(compSigs);\n\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n const isResolvedComponentType = ['Invokable', 'TOC', 'ComponentLike'].includes(\n param.type\n );\n\n if (\n isResolvedComponentType &&\n (!param.componentRef || param.componentRef.filePath === '') &&\n componentNames.includes(param.name)\n ) {\n param.componentRef = {\n filePath,\n exportName: param.name,\n modifiers: param.componentRef?.modifiers\n };\n }\n }\n }\n }\n }\n\n return signatures;\n}\n\n// ── Modifier enrichment ────────────────────────────────────────\n\n/**\n * Recover WithBoundArgs/Omit/Pick wrappers from the source AST for block\n * params whose componentRef lost the wrapper structure in TypeDoc's output.\n * Requires real filesystem paths, resolved via the TypeDoc base directory.\n */\nfunction enrichBlockParamModifiers(\n signatures: ComponentSignatureMap,\n base: string | undefined\n): void {\n if (!base) return;\n\n for (const [relPath, compSigs] of Object.entries(signatures)) {\n const absKey = path.resolve(base, relPath);\n\n if (!existsSync(absKey)) continue;\n\n const modifiers = extractBlockParamModifiers(absKey);\n\n if (modifiers.length === 0) continue;\n\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n if (\n param.componentRef &&\n !(param.componentRef.modifiers && param.componentRef.modifiers.length > 0)\n ) {\n const mod = modifiers.find((m) => m.paramName === param.name);\n\n if (mod) {\n param.componentRef.modifiers = [{ name: mod.wrapperName, typeArgs: mod.boundKeys }];\n }\n }\n }\n }\n }\n }\n}\n\n// ── Public API ─────────────────────────────────────────────────\n\nexport function analyze(\n reflections: JSONOutput.ProjectReflection,\n opts?: DocgenOptions\n): ComponentSignatureMap {\n const { idToPath, idToReflection } = buildReflectionMaps(reflections);\n const parsed = extractInterfaceSignatures(reflections, idToReflection, idToPath);\n const signatures = associateComponents(reflections, idToReflection, parsed);\n\n resolveMarkerRefs(signatures);\n\n const base = resolveTsconfigBase(opts);\n\n enrichBlockParamModifiers(signatures, base);\n\n return signatures;\n}\n","import path from 'node:path';\n\nimport type { StoryFilePath } from './types';\n\nconst COMPONENT_RE = /\\.g[tj]s$/;\n\nexport const PROJECT_ROOT = process.cwd();\n\nexport { Default } from 'ember-docgen';\n\nexport type ExportedName = string;\n\nexport function normalizeFilePath(absPath: string): string {\n const relative = path.relative(PROJECT_ROOT, absPath);\n\n return './' + relative.replaceAll('\\\\', '/');\n}\n\nconst storyFiles = new Set<string>();\n\nconst listeners = new Set<(filePath: string) => void>();\n\nexport function addStoryFileListener(listener: (filePath: string) => void): () => void {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function registerStoryFile(filePath: string) {\n storyFiles.add(filePath);\n\n for (const listener of listeners) {\n listener(filePath);\n }\n}\n\nexport function getStoryFiles(): StoryFilePath[] {\n return [...storyFiles];\n}\n\nexport function isStoryFile(filePath: string): boolean {\n return storyFiles.has(filePath);\n}\n\nexport function isComponentFile(filePath: string): boolean {\n return COMPONENT_RE.test(filePath) && !isStoryFile(filePath);\n}\n","import { readFile } from 'node:fs/promises';\n\nimport { Preprocessor } from 'content-tag';\nimport { type CsfOptions, loadCsf } from 'storybook/internal/csf-tools';\n\nimport { registerStoryFile } from './shared';\n\nimport type { Indexer, IndexerOptions, IndexInput } from 'storybook/internal/types';\n\nfunction parse(fileName: string, code: string) {\n const preprocessor = new Preprocessor();\n\n return preprocessor.process(code, { filename: fileName });\n}\n\nexport const readCsf = async (fileName: string, options: CsfOptions) => {\n const code = await readFile(fileName, 'utf8');\n const result = parse(fileName, code);\n\n return loadCsf(result.code, { ...options, fileName });\n};\n\nexport const emberIndexer: Indexer = {\n test: /\\.stories\\.g[tj]s$/,\n\n createIndex: async (fileName: string, options: IndexerOptions): Promise<IndexInput[]> => {\n const rawCode = await readFile(fileName, 'utf8');\n const result = parse(fileName, rawCode);\n const csf = loadCsf(result.code, { ...options, fileName });\n const parsed = csf.parse();\n const inputs = parsed.indexInputs;\n\n registerStoryFile(fileName);\n\n return inputs;\n }\n};\n","import { readFileSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { Preprocessor } from 'content-tag';\nimport { parseSync, Visitor } from 'oxc-parser';\nimport { loadCsf, type StaticMeta, type StaticStory } from 'storybook/internal/csf-tools';\n\nimport { Default, type ExportedName, normalizeFilePath } from './shared';\n\nimport type { ExportSpecifier, Program, VariableDeclarator } from 'oxc-parser';\n\n/**\n * A map with contents of a component file:\n *\n * - `key`: The component name in the file\n * - `value`:\n * - `string`: The exported component name\n * - `undefined`: Not exported\n * - `Default`: default export\n */\nexport type ComponentMap = Record<ExportedName, string>;\n\nexport function readAndPreprocess(filePath: string): { rawCode: string; processedCode: string } {\n const rawCode = readFileSync(filePath, 'utf8');\n\n if (!filePath.endsWith('.gts') && !filePath.endsWith('.gjs')) {\n return { rawCode, processedCode: rawCode };\n }\n\n const pp = new Preprocessor();\n const result = pp.process(rawCode, { filename: filePath });\n\n return { rawCode, processedCode: result.code };\n}\n\nexport function parseProcessedCode(processedCode: string, filePath: string): Program {\n return parseSync(filePath, processedCode, {\n lang: filePath.endsWith('.gts') || filePath.endsWith('.ts') ? 'ts' : 'js',\n sourceType: 'module'\n }).program;\n}\n\n/**\n * Result of parsing a story file, covering all subsystem needs.\n */\nexport interface StoryFile {\n meta: StaticMeta;\n component: {\n /**\n * Project-relative path to the component file.\n * Set only when the component is imported from a local module.\n */\n file?: string;\n\n /**\n * The key to look up the component's signature in the component\n * file's signatures record. Matches TypeDoc's deriveComponentName.\n *\n * - `\"Greeting\"` for `export const Greeting = ...`\n * - `\"Card\"` for `export { Card as CardExport }`\n * - `\"Button\"` for `export default class Button ...`\n */\n signatureName?: string;\n\n /**\n * The name used to invoke the component in generated source.\n * Differs from `signatureName` for default exports, where the\n * signature is keyed by the `__DEFAULT__` sentinel but the real\n * component name (e.g. `\"Button\"`) is known from the component file.\n */\n name?: string;\n };\n\n stories: (StaticStory & { inlineTemplate?: string })[];\n}\n\n// ── Private helpers ────────────────────────────────────────────\n\nfunction firstVarExportName(declarations: VariableDeclarator[]): string | undefined {\n if (declarations.length === 0) return undefined;\n\n const first = declarations[0];\n\n if (first.id.type === 'Identifier') return first.id.name;\n\n return undefined;\n}\n\nfunction firstSpecExportName(specifiers: ExportSpecifier[]): string | undefined {\n if (specifiers.length === 0) return undefined;\n\n const first = specifiers[0];\n\n if (first.exported.type === 'Identifier') return first.exported.name;\n\n return undefined;\n}\n\nfunction firstSpecLocalName(specifiers: ExportSpecifier[]): string | undefined {\n if (specifiers.length === 0) return undefined;\n\n const first = specifiers[0];\n\n if (first.local.type === 'Identifier') return first.local.name;\n\n return undefined;\n}\n\n// ── Signature name resolution ──────────────────────────────────\n\nfunction findSignatureName(\n compMeta: ComponentMap | undefined,\n importedName: string | undefined\n): string | undefined {\n if (!compMeta) return undefined;\n if (importedName === Default) return Default;\n\n return importedName !== undefined && Object.hasOwn(compMeta, importedName)\n ? importedName\n : undefined;\n}\n\n// ── Public API ─────────────────────────────────────────────────\n\n/**\n * Parse a component file and return a map of all declarations.\n *\n * Each key is the internal variable/class name, each value is:\n * - `string` for named exports (the export name)\n * - `Default` for `export default`\n * - `undefined` for non-exported declarations\n */\nexport function parseComponentFile(compPath: string): ComponentMap | undefined {\n let program: Program;\n\n try {\n const { processedCode } = readAndPreprocess(compPath);\n\n program = parseProcessedCode(processedCode, compPath);\n } catch {\n return undefined;\n }\n\n const result: ComponentMap = {};\n const handled = new Set<string>();\n\n const visitor = new Visitor({\n ExportNamedDeclaration(node) {\n if (node.declaration?.type === 'VariableDeclaration') {\n const name = firstVarExportName(node.declaration.declarations);\n\n if (name && !handled.has(name)) {\n handled.add(name);\n result[name] = name;\n }\n }\n\n if (node.specifiers.length > 0) {\n const specExported = firstSpecExportName(node.specifiers);\n const specLocal = firstSpecLocalName(node.specifiers);\n\n if (specLocal && specExported) {\n handled.add(specLocal);\n result[specExported] = specLocal;\n } else if (specExported) {\n handled.add(specExported);\n result[specExported] = specExported;\n }\n }\n },\n\n VariableDeclaration(node) {\n const name = firstVarExportName(node.declarations);\n\n if (name && !handled.has(name)) {\n handled.add(name);\n // result[name] = undefined;\n }\n },\n\n ExportDefaultDeclaration(node) {\n const decl = node.declaration;\n\n let internalName: string | undefined;\n\n if (decl.type === 'ClassDeclaration' && decl.id?.type === 'Identifier') {\n internalName = decl.id.name;\n } else if (decl.type === 'Identifier') {\n internalName = decl.name;\n }\n\n if (internalName && !handled.has(internalName)) {\n handled.add(internalName);\n result[Default] = internalName;\n }\n }\n });\n\n visitor.visit(program);\n\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\n/**\n * Parse a story file and return metadata about the component it references,\n * including template sources for each named story export.\n */\nexport function parseStoryFile(storyPath: string): StoryFile | undefined {\n const { processedCode } = readAndPreprocess(storyPath);\n\n // ── 1. CSF parsing — gives meta, story IDs, local names ──\n let meta: StaticMeta | undefined = {};\n let stories: (StaticStory & { inlineTemplate?: string })[] = [];\n\n try {\n const csf = loadCsf(processedCode, {\n fileName: storyPath,\n makeTitle: (userTitle: string | undefined) => userTitle ?? 'unknown'\n });\n const parsed = csf.parse();\n\n meta = parsed.meta;\n stories = parsed.stories;\n } catch {\n // CSF parsing failed — return partial result\n }\n\n // ── 2. Oxc walk — imports + inline templates ──\n const program = parseProcessedCode(processedCode, storyPath);\n const importMap = new Map<string, { source: string; importedName: string | undefined }>();\n const exportStack: ((StaticStory & { inlineTemplate?: string }) | undefined)[] = [];\n\n const visitor = new Visitor({\n ImportDeclaration(node) {\n for (const spec of node.specifiers) {\n const importedName =\n spec.type === 'ImportDefaultSpecifier'\n ? Default\n : spec.type === 'ImportSpecifier'\n ? spec.imported.type === 'Identifier'\n ? spec.imported.name\n : spec.imported.value\n : undefined;\n\n importMap.set(spec.local.name, { source: node.source.value, importedName });\n }\n },\n\n ExportNamedDeclaration(node) {\n if (node.declaration?.type !== 'VariableDeclaration') return;\n if (node.declaration.declarations.length === 0) return;\n\n const first = node.declaration.declarations[0];\n\n if (first.id.type !== 'Identifier') return;\n\n const name = (first.id as { name: string }).name;\n const story = stories.find((s) => (s.localName ?? s.name) === name);\n\n exportStack.push(story);\n },\n\n 'ExportNamedDeclaration:exit'() {\n exportStack.pop();\n },\n\n CallExpression(node) {\n const currentStory = exportStack.at(-1);\n\n if (!currentStory || currentStory.inlineTemplate) return;\n if (node.callee.type !== 'Identifier') return;\n if (!node.callee.name.startsWith('template_')) return;\n if (node.arguments.length === 0) return;\n\n const firstArg = node.arguments[0];\n\n if (firstArg.type !== 'TemplateLiteral') return;\n\n const raw = firstArg.quasis[0]?.value?.raw;\n\n if (raw) currentStory.inlineTemplate = raw;\n }\n });\n\n visitor.visit(program);\n\n // ── 3. Resolve component ──\n const localComponentName = meta.component;\n\n if (!localComponentName) {\n return { meta: meta, component: {}, stories };\n }\n\n const importInfo = importMap.get(localComponentName);\n\n if (!importInfo) {\n return {\n meta,\n component: { signatureName: localComponentName },\n stories\n };\n }\n\n const compPath = normalizeFilePath(path.resolve(path.dirname(storyPath), importInfo.source));\n const compMeta = parseComponentFile(compPath);\n const signatureName = findSignatureName(compMeta, importInfo.importedName);\n\n return {\n meta,\n component: {\n file: compPath,\n signatureName: signatureName ?? localComponentName,\n name: signatureName === Default ? (compMeta?.[Default] ?? localComponentName) : undefined\n },\n stories\n };\n}\n","import { addStoryFileListener, isComponentFile, normalizeFilePath } from './shared';\n\nimport type { HmrContext, Plugin, ViteDevServer } from 'vite';\n\nconst VIRTUAL = 'virtual:ember-storybook';\nconst RESOLVED = '\\0' + VIRTUAL;\n\nexport interface ContributorAPI {\n contribute(name: string, data: Record<string, unknown>): void;\n getContributions(): Map<string, Record<string, unknown>>;\n invalidate?: () => void;\n}\n\nexport function emberStorybookVitePlugin(api: ContributorAPI): Plugin {\n let server: ViteDevServer | undefined;\n\n function invalidate() {\n if (!server) return;\n\n const mod = server.moduleGraph.getModuleById(RESOLVED);\n\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n }\n\n server.ws.send({ type: 'full-reload' });\n }\n\n addStoryFileListener(() => {\n invalidate();\n });\n\n return {\n name: 'ember-storybook',\n\n resolveId(id) {\n if (id === VIRTUAL) return RESOLVED;\n },\n\n load(id) {\n if (id !== RESOLVED) return;\n\n const contributions = api.getContributions();\n const merged: Record<string, Record<string, unknown>> = {};\n\n for (const [name, data] of contributions) {\n for (const [filePath, value] of Object.entries(data)) {\n const relPath = normalizeFilePath(filePath);\n let normalizedValue = value;\n\n if (name === 'component' && typeof value === 'object' && value !== null) {\n const compValue = value as Record<string, string | undefined>;\n\n if (compValue.file) {\n normalizedValue = { ...compValue, file: normalizeFilePath(compValue.file) };\n }\n }\n\n (merged[relPath] ??= {})[name] = normalizedValue;\n }\n }\n\n return {\n code: `export default ${JSON.stringify(merged)};`,\n map: undefined\n };\n },\n\n handleHotUpdate(ctx: HmrContext) {\n // eslint-disable-next-line unicorn/prefer-early-return\n if (isComponentFile(ctx.file)) {\n const virtualMod = ctx.server.moduleGraph.getModuleById(RESOLVED);\n\n if (virtualMod) {\n ctx.server.moduleGraph.invalidateModule(virtualMod);\n }\n\n ctx.server.ws.send({ type: 'full-reload' });\n\n return [];\n }\n },\n\n configureServer(srv) {\n server = srv;\n api.invalidate = invalidate;\n }\n };\n}\n","import { existsSync } from 'node:fs';\nimport path from 'node:path';\n\nimport { analyze, parseFile } from 'ember-docgen';\n\nimport { unwrapBlockParams } from '../../client/docs/block-params';\nimport { normalizeFilePath } from '../shared';\n\nimport type { ComponentSignatureMap } from 'ember-docgen';\n\n/**\n * Resolve the directory of the project's tsconfig, replicating TypeDoc's\n * discovery: walk up from cwd. parseFile pins TypeDoc's displayBasePath to\n * this directory, so analyze's JSON paths are relative to it.\n */\nfunction resolveTsconfigBase(): string | undefined {\n const findUp = (dir: string): string | undefined => {\n if (existsSync(path.join(dir, 'tsconfig.json'))) {\n return dir;\n }\n\n const parent = path.dirname(dir);\n\n return parent === dir ? undefined : findUp(parent);\n };\n\n return findUp(process.cwd());\n}\n\n/**\n * Rewrite componentRef.filePath from tsconfig-relative to project-root-relative\n * (`./`-prefixed) paths, so consumers can look signatures up in the meta map.\n */\nfunction rewriteFilePaths(mapped: ComponentSignatureMap, base: string): void {\n for (const compSigs of Object.values(mapped)) {\n for (const compSig of Object.values(compSigs)) {\n for (const blockInfo of Object.values(compSig.blocks)) {\n for (const param of unwrapBlockParams(blockInfo.params)) {\n if (param.componentRef?.filePath) {\n param.componentRef.filePath = normalizeFilePath(\n path.resolve(base, param.componentRef.filePath)\n );\n }\n }\n }\n }\n }\n}\n\nexport async function runTypeDoc(entryPoints: string[]): Promise<ComponentSignatureMap> {\n if (entryPoints.length === 0) {\n return {};\n }\n\n const base = resolveTsconfigBase();\n\n if (!base) {\n return {};\n }\n\n try {\n // Component signatures, keyed by absolute entry-point paths.\n // Transitive subcomponents (not in the entry points) are included too.\n const mapped: ComponentSignatureMap = {};\n\n for (const file of entryPoints) {\n const json = await parseFile(file);\n const extracted = analyze(json);\n\n for (const [relPath, compSigs] of Object.entries(extracted)) {\n const absKey = path.resolve(base, relPath);\n\n mapped[absKey] ??= {};\n Object.assign(mapped[absKey], compSigs);\n }\n }\n\n rewriteFilePaths(mapped, base);\n\n return mapped;\n } catch (error) {\n console.warn('[ember-storybook] TypeDoc extraction failed:', error);\n\n return {};\n }\n}\n","import path from 'node:path';\n\nimport { parseStoryFile } from '../parser';\nimport { getStoryFiles, isComponentFile, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\nimport { runTypeDoc } from './docgen';\n\nimport type { ComponentSignatureMap } from 'ember-docgen';\nimport type { Plugin } from 'vite';\n\ninterface ComponentRef {\n componentName: string;\n componentPath: string;\n}\n\ninterface SignaturesState {\n storyToRef: Map<string, ComponentRef>;\n signatures: ComponentSignatureMap;\n}\n\nfunction isReferenced(state: SignaturesState, componentFile: string): boolean {\n const abs = path.resolve(componentFile);\n\n for (const r of state.storyToRef.values()) {\n if (r.componentPath === abs) return true;\n }\n\n return false;\n}\n\nfunction resolveComponentRef(storyFilePath: string): ComponentRef | undefined {\n const result = parseStoryFile(storyFilePath);\n\n if (!result?.component.file) return undefined;\n\n const componentPath = path.resolve(result.component.file);\n\n return { componentName: result.meta.component ?? '', componentPath };\n}\n\nasync function addSignatures(\n state: SignaturesState,\n componentPaths: string[]\n): Promise<SignaturesState> {\n const absPaths = componentPaths.map((cp) => path.resolve(cp));\n const missing = absPaths.filter((abs) => !Object.hasOwn(state.signatures, abs));\n\n if (missing.length === 0) return state;\n\n const newSigs = await runTypeDoc(missing);\n\n const merged = { ...state.signatures };\n\n for (const [filePath, compSigs] of Object.entries(newSigs)) {\n merged[filePath] = { ...merged[filePath], ...compSigs };\n }\n\n return { ...state, signatures: merged };\n}\n\nexport function signaturesContributor(api: ContributorAPI): Plugin {\n let state: SignaturesState = {\n storyToRef: new Map(),\n signatures: {}\n };\n\n function contributeState() {\n api.contribute('signatures', state.signatures);\n }\n\n function discoverAll() {\n const files = getStoryFiles();\n\n const next = new Map<string, ComponentRef>();\n\n for (const file of files) {\n const ref = resolveComponentRef(file);\n\n if (ref) {\n next.set(file, ref);\n }\n }\n\n state.storyToRef = next;\n }\n\n async function processStoryAdd(storyFile: string) {\n const ref = resolveComponentRef(storyFile);\n\n if (!ref) return;\n\n state.storyToRef.set(storyFile, ref);\n state = await addSignatures(state, [ref.componentPath]);\n contributeState();\n }\n\n function processStoryChange(storyFile: string) {\n state.storyToRef.delete(storyFile);\n\n const ref = resolveComponentRef(storyFile);\n\n if (ref) {\n state.storyToRef.set(storyFile, ref);\n }\n\n contributeState();\n }\n\n function processStoryUnlink(storyFile: string) {\n state.storyToRef.delete(storyFile);\n contributeState();\n }\n\n async function processComponentChange(componentFile: string) {\n const absFile = path.resolve(componentFile);\n\n if (!isReferenced(state, absFile)) return;\n\n const newSigs = await runTypeDoc([absFile]);\n const merged = { ...state.signatures };\n\n for (const [filePath, compSigs] of Object.entries(newSigs)) {\n merged[filePath] = { ...merged[filePath], ...compSigs };\n }\n\n state = { ...state, signatures: merged };\n contributeState();\n }\n\n return {\n name: 'ember-storybook:signatures',\n\n async buildStart() {\n discoverAll();\n\n const allPaths = [...new Set(Array.from(state.storyToRef.values(), (r) => r.componentPath))];\n\n state = await addSignatures(state, allPaths);\n contributeState();\n },\n\n configureServer(server) {\n server.watcher.on('add', (changedFile) => {\n if (isStoryFile(changedFile)) {\n void processStoryAdd(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n\n server.watcher.on('change', (changedFile) => {\n if (isStoryFile(changedFile)) {\n processStoryChange(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n\n server.watcher.on('unlink', (changedFile) => {\n if (isStoryFile(changedFile)) {\n processStoryUnlink(changedFile);\n } else if (isComponentFile(changedFile)) {\n void processComponentChange(changedFile);\n }\n });\n }\n };\n}\n","import { parseStoryFile } from '../parser';\nimport { getStoryFiles, isComponentFile, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\n\nimport type { StaticMeta } from 'storybook/internal/csf-tools';\nimport type { Plugin } from 'vite';\n\nexport interface ComponentMeta {\n file?: string;\n signatureName?: string;\n}\n\nfunction computeDataForStory(file: string): {\n meta: Record<string, StaticMeta>;\n component: Record<string, ComponentMeta>;\n} {\n const storyResult = parseStoryFile(file);\n\n if (!storyResult?.meta.component) {\n return { meta: {}, component: {} };\n }\n\n return {\n meta: { [file]: storyResult.meta },\n component: {\n [file]: {\n file: storyResult.component.file,\n signatureName: storyResult.component.signatureName\n }\n }\n };\n}\n\nexport function metaContributor(api: ContributorAPI): Plugin {\n let fileMeta: Record<string, StaticMeta> = {};\n let fileComponent: Record<string, ComponentMeta> = {};\n\n function recontribute() {\n api.contribute('meta', { ...fileMeta });\n api.contribute('component', { ...fileComponent });\n }\n\n function syncAll() {\n let meta: Record<string, StaticMeta> = {};\n let component: Record<string, ComponentMeta> = {};\n\n for (const file of getStoryFiles()) {\n const data = computeDataForStory(file);\n\n meta = { ...meta, ...data.meta };\n component = { ...component, ...data.component };\n }\n\n fileMeta = meta;\n fileComponent = component;\n recontribute();\n }\n\n function storiesForComponent(compPath: string): string[] {\n return Object.entries(fileComponent)\n .filter(([, v]) => v.file === compPath)\n .map(([k]) => k);\n }\n\n return {\n name: 'ember-storybook:meta',\n\n buildStart() {\n syncAll();\n },\n\n configureServer(server) {\n server.watcher.on('add', (changedPath) => {\n // eslint-disable-next-line unicorn/prefer-early-return\n if (isStoryFile(changedPath)) {\n const data = computeDataForStory(changedPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n recontribute();\n }\n });\n\n server.watcher.on('change', (changedPath) => {\n if (isStoryFile(changedPath)) {\n const data = computeDataForStory(changedPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n recontribute();\n } else if (isComponentFile(changedPath)) {\n for (const storyPath of storiesForComponent(changedPath)) {\n const data = computeDataForStory(storyPath);\n\n fileMeta = { ...fileMeta, ...data.meta };\n fileComponent = { ...fileComponent, ...data.component };\n }\n\n recontribute();\n }\n });\n\n server.watcher.on('unlink', (changedPath) => {\n if (!(isStoryFile(changedPath) || isComponentFile(changedPath))) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete fileMeta[changedPath];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete fileComponent[changedPath];\n recontribute();\n });\n }\n };\n}\n","import { parseStoryFile } from '../parser';\nimport { getStoryFiles, isStoryFile } from '../shared';\nimport { type ContributorAPI } from '../vite-plugin-orchestrator';\n\nimport type { StorySource } from '../types';\nimport type { Plugin } from 'vite';\n\nexport function sourceContributor(api: ContributorAPI): Plugin {\n let fileMeta: Record<string, Record<string, StorySource>> = {};\n\n function contribute() {\n api.contribute('source', { ...fileMeta });\n }\n\n function extractSource(filePath: string): Record<string, StorySource> {\n const result = parseStoryFile(filePath);\n const output: Record<string, StorySource> = {};\n\n for (const story of result?.stories ?? []) {\n output[story.id] = {\n inlineTemplate: story.inlineTemplate,\n componentName: result?.component.name ?? result?.component.signatureName,\n signatureName: result?.component.signatureName\n };\n }\n\n return output;\n }\n\n function refreshMeta(storyPath: string) {\n try {\n fileMeta[storyPath] = extractSource(storyPath);\n contribute();\n } catch {\n // file extraction failed\n }\n }\n\n return {\n name: 'ember-storybook:source',\n\n buildStart() {\n const files = getStoryFiles().filter((f) => isStoryFile(f));\n const data: Record<string, Record<string, StorySource>> = {};\n\n for (const file of files) {\n data[file] = extractSource(file);\n }\n\n fileMeta = data;\n contribute();\n },\n\n configureServer(server) {\n server.watcher.on('add', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n refreshMeta(storyPath);\n });\n\n server.watcher.on('change', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n refreshMeta(storyPath);\n });\n\n server.watcher.on('unlink', (storyPath) => {\n if (!isStoryFile(storyPath)) return;\n\n Reflect.deleteProperty(fileMeta, storyPath);\n contribute();\n });\n }\n };\n}\n","import { signaturesContributor } from './docgen/vite-plugin';\nimport { metaContributor } from './meta/vite-plugin';\nimport { sourceContributor } from './source/vite-plugin';\nimport { type ContributorAPI, emberStorybookVitePlugin } from './vite-plugin-orchestrator';\n\nimport type { Plugin } from 'vite';\n\nexport function emberStorybookPlugin(): Plugin[] {\n const contributions = new Map<string, Record<string, unknown>>();\n\n const api: ContributorAPI = {\n contribute(name, data) {\n contributions.set(name, data);\n api.invalidate?.();\n },\n getContributions: () => contributions\n };\n\n return [\n emberStorybookVitePlugin(api),\n metaContributor(api),\n sourceContributor(api),\n signaturesContributor(api)\n ];\n}\n","import { fileURLToPath } from 'node:url';\n\nimport { type StorybookConfigVite, withoutVitePlugins } from '@storybook/builder-vite';\n\nimport { emberIndexer } from './node/indexer';\nimport { emberStorybookPlugin } from './node/vite-plugin';\n\nimport type { StorybookConfig } from './types';\nimport type { PresetProperty } from 'storybook/internal/types';\nimport type { Plugin, UserConfig } from 'vite';\n\n// The generated preview imports the addon-docs preview by its absolute path.\n// Redirect that import to our patched module so `docs.renderer` is overridden\n// with the stable-key DocsRenderer (the framework's own `docs.renderer` never\n// wins the annotation merge, and mutating the module in place is unreliable due\n// to Vite dep pre-bundling splitting module instances).\nfunction docsRendererPlugin(docsPreviewPatch: string): Plugin {\n return {\n name: 'ember-storybook:docs-renderer',\n enforce: 'pre',\n resolveId(source) {\n if (source.includes('@storybook/addon-docs') && source.endsWith('preview.js')) {\n return docsPreviewPatch;\n }\n }\n };\n}\n\nexport const previewAnnotations: PresetProperty<'previewAnnotations'> = async (\n // eslint-disable-next-line @typescript-eslint/default-param-last\n entries = [],\n options\n) => {\n const config = fileURLToPath(import.meta.resolve('ember-storybook/client/config'));\n const annotations = [...entries, config];\n\n const docsConfig = await options.presets.apply('docs', {}, options);\n const docsEnabled = Object.keys(docsConfig).length > 0;\n\n if (docsEnabled) {\n const docsConfigPath = fileURLToPath(import.meta.resolve('ember-storybook/client/docs/config'));\n\n annotations.push(docsConfigPath);\n }\n\n return annotations;\n};\n\nexport const viteFinal: StorybookConfigVite['viteFinal'] = async (config: UserConfig) => {\n const { mergeConfig } = await import('vite');\n\n config.plugins = await withoutVitePlugins(config.plugins, ['embroider-content-for']);\n\n const docsPreviewPatch = fileURLToPath(\n import.meta.resolve('ember-storybook/client/docs/preview-patch')\n );\n\n return mergeConfig(config, {\n plugins: [...emberStorybookPlugin(), docsRendererPlugin(docsPreviewPatch)],\n optimizeDeps: {\n exclude: ['object-inspect']\n },\n resolve: {\n dedupe: ['ember-source']\n }\n });\n};\n\nexport const experimental_indexers: StorybookConfig['experimental_indexers'] = (indexers) => {\n return [emberIndexer, ...(indexers ?? [])];\n};\n\nexport const core: PresetProperty<'core'> = async (config, options) => {\n const framework = await options.presets.apply('framework');\n\n return {\n ...config,\n builder: {\n name: import.meta.resolve('@storybook/builder-vite'),\n options:\n typeof framework === 'string'\n ? {}\n : // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n ((framework.options?.builder ?? {}) as object)\n }\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAMA,KAAK,IAAIC,aAAa;AAE5B,MAAMC,UAAU;AAChB,MAAMC,UAAU;AAChB,MAAMC,aAAa;AACnB,MAAMC,aAAa;AAEnB,SAAgBC,kBAAkBC,UAAkB;CAClD,OAAOL,QAAQM,KAAKD,QAAQ;AAC9B;AAEA,SAAgBE,kBAAkBF,UAAkB;CAClD,OAAOJ,QAAQK,KAAKD,QAAQ;AAC9B;AAEA,SAAgBG,kBAAgBH,UAAkB;CAChD,OAAOD,kBAAkBC,QAAQ,KAAKE,kBAAkBF,QAAQ;AAClE;AAEA,SAAgBI,8BAA8BJ,UAAkB;CAC9D,OAAOH,WAAWI,KAAKD,QAAQ;AACjC;AAEA,SAAgBK,8BAA8BL,UAAkB;CAC9D,OAAOF,WAAWG,KAAKD,QAAQ;AACjC;AAEA,SAAgBM,4BAA4BN,UAAkB;CAC5D,OAAOI,8BAA8BJ,QAAQ,KAAKK,8BAA8BL,QAAQ;AAC1F;AAEA,SAAgBO,aAAaC,aAAqB;CAChD,OAAOA,YAAYC,QAAQ,oBAAoB,KAAK;AACtD;AAMA,SAAgBG,qBAAqBZ,UAAkB;CACrD,MAAMa,MAAMC,aAAad,UAAU,MAAM;CACzC,OAAOP,GAAGsB,QAAQF,KAAK,EAAEG,UAAUhB,SAAS,CAAC,CAAC,CAACiB;AACjD;;;;;;;;;AAUA,SAAgBC,gBAAgBC,M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,MAAMC,iBAAiB3B,cAAcgB,OAAOC,KAAKC,QAAQ,oCAAoC,CAAC;EAE9FC,YAAYS,KAAKD,cAAc;CACjC;CAEA,OAAOR;AACT;AAEA,MAAaU,YAA8C,OAAOd,WAAuB;CACvF,MAAM,EAAEe,gBAAgB,MAAM,OAAO;CAErCf,OAAOgB,UAAU,MAAM9B,mBAAmBc,OAAOgB,SAAS,CAAC,uBAAuB,CAAC;CAEnF,MAAM1B,mBAAmBL,cACvBgB,OAAOC,KAAKC,QAAQ,2CAA2C,CACjE;CAEA,OAAOY,YAAYf,QAAQ;EACzBgB,SAAS,CAAC,GAAG5B,qBAAqB,GAAGC,mBAAmBC,gBAAgB,CAAC;EACzE2B,cAAc,EACZC,SAAS,CAAC,gBAAgB,EAC5B;EACAf,SAAS,EACPgB,QAAQ,CAAC,cAAc,EACzB;CACF,CAAC;AACH;AAEA,MAAaC,yBAAmEC,aAAa;CAC3F,OAAO,CAAClC,cAAc,GAAIkC,YAAY,CAAA,CAAG;AAC3C;AAEA,MAAaC,OAA+B,OAAOtB,QAAQD,YAAY;CACrE,MAAMwB,YAAY,MAAMxB,QAAQO,QAAQC,MAAM,WAAW;CAEzD,OAAO;EACL,GAAGP;EACHwB,SAAS;GACPjC,MAAMU,OAAOC,KAAKC,QAAQ,yBAAyB;GACnDJ,SACE,OAAOwB,cAAc,WACjB,CAAC,IAECA,UAAUxB,SAASyB,WAAW,CAAC;EACzC;CACF;AACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region ../node_modules/.pnpm/@mdx-js+react@3.1.1_@types+react@19.2.17_react@19.2.7/node_modules/@mdx-js/react/lib/index.js
|
|
3
|
+
/**
|
|
4
|
+
* @import {MDXComponents} from 'mdx/types.js'
|
|
5
|
+
* @import {Component, ReactElement, ReactNode} from 'react'
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @callback MergeComponents
|
|
9
|
+
* Custom merge function.
|
|
10
|
+
* @param {Readonly<MDXComponents>} currentComponents
|
|
11
|
+
* Current components from the context.
|
|
12
|
+
* @returns {MDXComponents}
|
|
13
|
+
* Additional components.
|
|
14
|
+
*
|
|
15
|
+
* @typedef Props
|
|
16
|
+
* Configuration for `MDXProvider`.
|
|
17
|
+
* @property {ReactNode | null | undefined} [children]
|
|
18
|
+
* Children (optional).
|
|
19
|
+
* @property {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
|
|
20
|
+
* Additional components to use or a function that creates them (optional).
|
|
21
|
+
* @property {boolean | null | undefined} [disableParentContext=false]
|
|
22
|
+
* Turn off outer component context (default: `false`).
|
|
23
|
+
*/
|
|
24
|
+
/** @type {Readonly<MDXComponents>} */
|
|
25
|
+
const emptyComponents = {};
|
|
26
|
+
const MDXContext = React.createContext(emptyComponents);
|
|
27
|
+
/**
|
|
28
|
+
* Get current components from the MDX Context.
|
|
29
|
+
*
|
|
30
|
+
* @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]
|
|
31
|
+
* Additional components to use or a function that creates them (optional).
|
|
32
|
+
* @returns {MDXComponents}
|
|
33
|
+
* Current components.
|
|
34
|
+
*/
|
|
35
|
+
function useMDXComponents(components) {
|
|
36
|
+
const contextComponents = React.useContext(MDXContext);
|
|
37
|
+
return React.useMemo(function() {
|
|
38
|
+
if (typeof components === "function") return components(contextComponents);
|
|
39
|
+
return {
|
|
40
|
+
...contextComponents,
|
|
41
|
+
...components
|
|
42
|
+
};
|
|
43
|
+
}, [contextComponents, components]);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Provider for MDX context.
|
|
47
|
+
*
|
|
48
|
+
* @param {Readonly<Props>} properties
|
|
49
|
+
* Properties.
|
|
50
|
+
* @returns {ReactElement}
|
|
51
|
+
* Element.
|
|
52
|
+
* @satisfies {Component}
|
|
53
|
+
*/
|
|
54
|
+
function MDXProvider(properties) {
|
|
55
|
+
/** @type {Readonly<MDXComponents>} */
|
|
56
|
+
let allComponents;
|
|
57
|
+
if (properties.disableParentContext) allComponents = typeof properties.components === "function" ? properties.components(emptyComponents) : properties.components || emptyComponents;
|
|
58
|
+
else allComponents = useMDXComponents(properties.components);
|
|
59
|
+
return React.createElement(MDXContext.Provider, { value: allComponents }, properties.children);
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { MDXProvider };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=react-BcVz11Jd.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-BcVz11Jd.mjs","names":["React","emptyComponents","MDXContext","createContext","useMDXComponents","components","contextComponents","useContext","useMemo","MDXProvider","properties","allComponents","disableParentContext","createElement","Provider","value","children"],"sources":["../../node_modules/.pnpm/@mdx-js+react@3.1.1_@types+react@19.2.17_react@19.2.7/node_modules/@mdx-js/react/lib/index.js"],"sourcesContent":["/**\n * @import {MDXComponents} from 'mdx/types.js'\n * @import {Component, ReactElement, ReactNode} from 'react'\n */\n\n/**\n * @callback MergeComponents\n * Custom merge function.\n * @param {Readonly<MDXComponents>} currentComponents\n * Current components from the context.\n * @returns {MDXComponents}\n * Additional components.\n *\n * @typedef Props\n * Configuration for `MDXProvider`.\n * @property {ReactNode | null | undefined} [children]\n * Children (optional).\n * @property {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]\n * Additional components to use or a function that creates them (optional).\n * @property {boolean | null | undefined} [disableParentContext=false]\n * Turn off outer component context (default: `false`).\n */\n\nimport React from 'react'\n\n/** @type {Readonly<MDXComponents>} */\nconst emptyComponents = {}\n\nconst MDXContext = React.createContext(emptyComponents)\n\n/**\n * Get current components from the MDX Context.\n *\n * @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]\n * Additional components to use or a function that creates them (optional).\n * @returns {MDXComponents}\n * Current components.\n */\nexport function useMDXComponents(components) {\n const contextComponents = React.useContext(MDXContext)\n\n // Memoize to avoid unnecessary top-level context changes\n return React.useMemo(\n function () {\n // Custom merge via a function prop\n if (typeof components === 'function') {\n return components(contextComponents)\n }\n\n return {...contextComponents, ...components}\n },\n [contextComponents, components]\n )\n}\n\n/**\n * Provider for MDX context.\n *\n * @param {Readonly<Props>} properties\n * Properties.\n * @returns {ReactElement}\n * Element.\n * @satisfies {Component}\n */\nexport function MDXProvider(properties) {\n /** @type {Readonly<MDXComponents>} */\n let allComponents\n\n if (properties.disableParentContext) {\n allComponents =\n typeof properties.components === 'function'\n ? properties.components(emptyComponents)\n : properties.components || emptyComponents\n } else {\n allComponents = useMDXComponents(properties.components)\n }\n\n return React.createElement(\n MDXContext.Provider,\n {value: allComponents},\n properties.children\n )\n}\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMC,kBAAkB,CAAC;AAEzB,MAAMC,aAAaF,MAAMG,cAAcF,eAAe;;;;;;;;;AAUtD,SAAgBG,iBAAiBC,YAAY;CAC3C,MAAMC,oBAAoBN,MAAMO,WAAWL,UAAU;CAGrD,OAAOF,MAAMQ,QACX,WAAY;EAEV,IAAI,OAAOH,eAAe,YACxB,OAAOA,WAAWC,iBAAiB;EAGrC,OAAO;GAAC,GAAGA;GAAmB,GAAGD;EAAU;CAC7C,GACA,CAACC,mBAAmBD,UAAU,CAChC;AACF;;;;;;;;;;AAWA,SAAgBI,YAAYC,YAAY;;CAEtC,IAAIC;CAEJ,IAAID,WAAWE,sBACbD,gBACE,OAAOD,WAAWL,eAAe,aAC7BK,WAAWL,WAAWJ,eAAe,IACrCS,WAAWL,cAAcJ;MAE/BU,gBAAgBP,iBAAiBM,WAAWL,UAAU;CAGxD,OAAOL,MAAMa,cACXX,WAAWY,UACX,EAACC,OAAOJ,cAAa,GACrBD,WAAWM,QACb;AACF"}
|
|
@@ -24,6 +24,11 @@ const render = (args, context) => {
|
|
|
24
24
|
if (typeof component === "object") return component;
|
|
25
25
|
throw new Error(`Unable to render story ${id} as the component annotation is missing from the default export`);
|
|
26
26
|
};
|
|
27
|
+
function shallowEqual(a, b) {
|
|
28
|
+
const aKeys = Object.keys(a);
|
|
29
|
+
const bKeys = Object.keys(b);
|
|
30
|
+
return aKeys.length === bKeys.length && aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]));
|
|
31
|
+
}
|
|
27
32
|
const contexts = /* @__PURE__ */ new Map();
|
|
28
33
|
function getAppOptions(opts) {
|
|
29
34
|
return {
|
|
@@ -42,6 +47,10 @@ function initApp(appOption, opts) {
|
|
|
42
47
|
if (isApplication(appOption)) return buildAppInstance(appOption, opts);
|
|
43
48
|
return initApp(appOption(getAppOptions(opts)), opts);
|
|
44
49
|
}
|
|
50
|
+
function updateArgs(currentArgs, nextArgs) {
|
|
51
|
+
for (const key of Object.keys(currentArgs)) if (!Object.hasOwn(nextArgs, key)) delete currentArgs[key];
|
|
52
|
+
Object.assign(currentArgs, nextArgs);
|
|
53
|
+
}
|
|
45
54
|
async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount }, canvasElement) {
|
|
46
55
|
const { trackedObject } = await import("@ember/reactive/collections");
|
|
47
56
|
const { renderComponent } = await import("@ember/renderer");
|
|
@@ -52,10 +61,33 @@ async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount },
|
|
|
52
61
|
const context = contexts.get(element);
|
|
53
62
|
if (!context) return;
|
|
54
63
|
contexts.delete(element);
|
|
55
|
-
context.renderer
|
|
56
|
-
|
|
64
|
+
context.renderer?.destroy();
|
|
65
|
+
context.mount.remove();
|
|
66
|
+
destroy(context.application);
|
|
57
67
|
}
|
|
58
68
|
if (forceRemount) unmount(canvasElement);
|
|
69
|
+
const context = contexts.get(canvasElement);
|
|
70
|
+
if (context && !forceRemount) {
|
|
71
|
+
const argsChanged = !shallowEqual(context.args, args);
|
|
72
|
+
const globalsChanged = !shallowEqual(context.globals, storyContext.globals);
|
|
73
|
+
if (globalsChanged) {
|
|
74
|
+
storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, context.application);
|
|
75
|
+
context.globals = { ...storyContext.globals };
|
|
76
|
+
}
|
|
77
|
+
if (argsChanged || !globalsChanged) {
|
|
78
|
+
updateArgs(context.args, args);
|
|
79
|
+
context.renderer = renderComponent(Component, {
|
|
80
|
+
args: context.args,
|
|
81
|
+
into: context.mount,
|
|
82
|
+
owner: context.application
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return () => {
|
|
86
|
+
unmount(canvasElement);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const mount = document.createElement("div");
|
|
90
|
+
canvasElement.append(mount);
|
|
59
91
|
let application;
|
|
60
92
|
if (storyContext.parameters.ember?.app) {
|
|
61
93
|
const appOption = storyContext.parameters.ember.app;
|
|
@@ -66,22 +98,28 @@ async function renderToCanvas({ storyFn, showMain, storyContext, forceRemount },
|
|
|
66
98
|
application.unregister(key);
|
|
67
99
|
application.register(key, obj);
|
|
68
100
|
}
|
|
101
|
+
storyContext.parameters.ember?.configure?.(application);
|
|
69
102
|
await application.boot();
|
|
103
|
+
storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, application);
|
|
70
104
|
const trackedArgs = trackedObject({ ...args });
|
|
105
|
+
contexts.set(canvasElement, {
|
|
106
|
+
application,
|
|
107
|
+
mount,
|
|
108
|
+
args: trackedArgs,
|
|
109
|
+
globals: storyContext.globals
|
|
110
|
+
});
|
|
71
111
|
const result = renderComponent(Component, {
|
|
72
112
|
args: trackedArgs,
|
|
73
|
-
into:
|
|
113
|
+
into: mount,
|
|
74
114
|
owner: application
|
|
75
115
|
});
|
|
76
|
-
contexts.
|
|
77
|
-
application,
|
|
78
|
-
renderer: result,
|
|
79
|
-
args: trackedArgs
|
|
80
|
-
});
|
|
116
|
+
contexts.get(canvasElement).renderer = result;
|
|
81
117
|
showMain();
|
|
82
|
-
return () => {
|
|
118
|
+
return () => {
|
|
119
|
+
unmount(canvasElement);
|
|
120
|
+
};
|
|
83
121
|
}
|
|
84
122
|
//#endregion
|
|
85
123
|
export { renderToCanvas as n, render_exports as r, render as t };
|
|
86
124
|
|
|
87
|
-
//# sourceMappingURL=render-
|
|
125
|
+
//# sourceMappingURL=render-B0rRnyCZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-B0rRnyCZ.mjs","names":["Application","ApplicationInstance","render","args","context","id","component","Error","shallowEqual","a","b","aKeys","Object","keys","bKeys","length","every","key","hasOwn","is","contexts","Map","getAppOptions","opts","autoboot","buildAppInstance","application","create","buildInstance","isApplication","maybeApp","undefined","superclass","name","initApp","appOption","updateArgs","currentArgs","nextArgs","assign","renderToCanvas","storyFn","showMain","storyContext","forceRemount","canvasElement","trackedObject","renderComponent","destroy","Component","unmount","element","get","delete","renderer","mount","remove","argsChanged","globalsChanged","globals","parameters","ember","updateGlobals","result","into","owner","document","createElement","append","app","rootElement","obj","entries","unregister","register","configure","boot","trackedArgs","set"],"sources":["../src/client/render.ts"],"sourcesContent":["import Application from '@ember/application';\nimport ApplicationInstance from '@ember/application/instance';\n\nimport type { AppParamater, EmberRenderer, StoryContext } from './types';\nimport type { RenderResult } from '@ember/-internals/glimmer/lib/renderer';\nimport type { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\n\ntype Args = Record<string, unknown>;\n\nexport const render: ArgsStoryFn<EmberRenderer> = (args, context) => {\n const { id, component } = context;\n\n if (typeof component === 'function') {\n return component;\n }\n\n if (typeof component === 'object') {\n return component;\n }\n\n throw new Error(\n `Unable to render story ${id} as the component annotation is missing from the default export`\n );\n};\n\nfunction shallowEqual(a: Record<string, unknown>, b: Record<string, unknown>) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n return (\n aKeys.length === bKeys.length &&\n aKeys.every((key) => Object.hasOwn(b, key) && Object.is(a[key], b[key]))\n );\n}\n\ntype RenderContextCache = {\n application: ApplicationInstance;\n renderer?: RenderResult;\n mount: HTMLElement;\n args: Args;\n globals: Record<string, unknown>;\n};\n\nconst contexts = new Map<EmberRenderer['canvasElement'], RenderContextCache>();\n\nfunction getAppOptions(opts: { rootElement: HTMLElement }) {\n return {\n ...opts,\n autoboot: false\n };\n}\n\nfunction buildAppInstance(application: typeof Application, opts: { rootElement: HTMLElement }) {\n return application.create(getAppOptions(opts)).buildInstance();\n}\n\nfunction isApplication(maybeApp: object): maybeApp is typeof Application {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n // @ts-expect-error well, ember types\n maybeApp.create !== undefined &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n maybeApp.superclass &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n maybeApp.superclass.name === 'EmberApp'\n );\n}\n\nfunction initApp(appOption: AppParamater, opts: { rootElement: HTMLElement }): ApplicationInstance {\n if (appOption instanceof ApplicationInstance) {\n return appOption;\n }\n\n if (isApplication(appOption)) {\n return buildAppInstance(appOption, opts);\n }\n\n // eslint-disable-next-line unicorn/no-useless-recursion\n return initApp(appOption(getAppOptions(opts)), opts);\n}\n\nfunction updateArgs(currentArgs: Args, nextArgs: Args) {\n for (const key of Object.keys(currentArgs)) {\n if (!Object.hasOwn(nextArgs, key)) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete currentArgs[key];\n }\n }\n\n Object.assign(currentArgs, nextArgs);\n}\n\nexport async function renderToCanvas(\n {\n storyFn,\n showMain,\n storyContext,\n forceRemount\n }: RenderContext<EmberRenderer> & { storyContext: StoryContext },\n canvasElement: EmberRenderer['canvasElement']\n) {\n const { trackedObject } = await import('@ember/reactive/collections');\n const { renderComponent } = await import('@ember/renderer');\n const { destroy } = await import('@ember/destroyable');\n\n const args = storyContext.args;\n const Component = storyFn();\n\n function unmount(element: EmberRenderer['canvasElement']) {\n const context = contexts.get(element);\n\n if (!context) {\n return;\n }\n\n contexts.delete(element);\n context.renderer?.destroy();\n\n context.mount.remove();\n\n destroy(context.application);\n }\n\n if (forceRemount) {\n unmount(canvasElement);\n }\n\n // this check does not work:\n // when globals are updated, that are interesting for a decorator\n // this check would prevent that update\n\n const context = contexts.get(canvasElement);\n\n if (context && !forceRemount) {\n const argsChanged = !shallowEqual(context.args, args);\n const globalsChanged = !shallowEqual(context.globals, storyContext.globals);\n\n if (globalsChanged) {\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, context.application);\n context.globals = { ...storyContext.globals };\n }\n\n if (argsChanged || !globalsChanged) {\n updateArgs(context.args, args);\n\n const result = renderComponent(Component, {\n args: context.args,\n into: context.mount,\n owner: context.application\n });\n\n context.renderer = result;\n }\n\n return () => {\n unmount(canvasElement);\n };\n }\n\n // fresh mount element per render, so ember's RENDER_CACHE never has a stale\n // entry for the `into` element (this is what caused the `insertBefore` error)\n const mount = document.createElement('div');\n\n canvasElement.append(mount);\n\n // find the ember app for the story\n let application: ApplicationInstance | undefined;\n\n if (storyContext.parameters.ember?.app) {\n const appOption = storyContext.parameters.ember.app;\n\n application = initApp(appOption, { rootElement: canvasElement });\n }\n\n application ??= buildAppInstance(Application, { rootElement: canvasElement });\n\n // modify the owner for the story\n if (storyContext.parameters.ember?.owner) {\n for (const [key, obj] of Object.entries(storyContext.parameters.ember.owner) as [\n `${string}:${string}`,\n object\n ][]) {\n application.unregister(key);\n application.register(key, obj);\n }\n }\n\n // configure and boot the instance so ember registers necessary environments\n storyContext.parameters.ember?.configure?.(application);\n await application.boot();\n storyContext.parameters.ember?.updateGlobals?.(storyContext.globals, application);\n\n const trackedArgs = trackedObject({ ...args });\n\n contexts.set(canvasElement, {\n application,\n mount,\n args: trackedArgs,\n globals: storyContext.globals\n });\n\n const result = renderComponent(Component, {\n args: trackedArgs,\n into: mount,\n owner: application\n });\n\n (contexts.get(canvasElement) as RenderContextCache).renderer = result;\n\n showMain();\n\n return () => {\n unmount(canvasElement);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAaE,UAAsCC,MAAMC,YAAY;CACnE,MAAM,EAAEC,IAAIC,cAAcF;CAE1B,IAAI,OAAOE,cAAc,YACvB,OAAOA;CAGT,IAA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AAa,EAAEsE,aAAazB,cAAc,CAAC;CAG5E,IAAIF,aAAaiB,WAAWC,OAAOI,OACjC,KAAK,MAAM,CAAChD,KAAKsD,QAAQ3D,OAAO4D,QAAQ7B,aAAaiB,WAAWC,MAAMI,KAAK,GAGtE;EACHvC,YAAY+C,WAAWxD,GAAG;EAC1BS,YAAYgD,SAASzD,KAAKsD,GAAG;CAC/B;CAIF5B,aAAaiB,WAAWC,OAAOc,YAAYjD,WAAW;CACtD,MAAMA,YAAYkD,KAAK;CACvBjC,aAAaiB,WAAWC,OAAOC,gBAAgBnB,aAAagB,SAASjC,WAAW;CAEhF,MAAMmD,cAAc/B,cAAc,EAAE,GAAG3C,KAAK,CAAC;CAE7CiB,SAAS0D,IAAIjC,eAAe;EAC1BnB;EACA6B;EACApD,MAAM0E;EACNlB,SAAShB,aAAagB;CACxB,CAAC;CAED,MAAMI,SAAShB,gBAAgBE,WAAW;EACxC9C,MAAM0E;EACNb,MAAMT;EACNU,OAAOvC;CACT,CAAC;CAEAN,SAASgC,IAAIP,aAAa,CAAC,CAAwBS,WAAWS;CAE/DrB,SAAS;CAET,aAAa;EACXQ,QAAQL,aAAa;CACvB;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-storybook",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Storybook for Ember: Develop, document, and test UI components in isolation",
|
|
6
6
|
"keywords": [
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"types": "./declarations/client/docs/config.d.ts",
|
|
39
39
|
"default": "./dist/client/docs/config.mjs"
|
|
40
40
|
},
|
|
41
|
+
"./client/docs/preview-patch": {
|
|
42
|
+
"types": "./declarations/client/docs/preview-patch.d.ts",
|
|
43
|
+
"default": "./dist/client/docs/preview-patch.mjs"
|
|
44
|
+
},
|
|
41
45
|
"./node": {
|
|
42
46
|
"types": "./declarations/node/index.d.ts",
|
|
43
47
|
"default": "./dist/node/index.mjs"
|
|
@@ -81,6 +85,8 @@
|
|
|
81
85
|
"@gossi/config-prettier": "^1.2.2",
|
|
82
86
|
"@rollup/plugin-babel": "^7.1.0",
|
|
83
87
|
"@storybook/addon-docs": "10.5.0",
|
|
88
|
+
"@storybook/react-dom-shim": "10.5.0",
|
|
89
|
+
"@mdx-js/react": "^3.1.0",
|
|
84
90
|
"@types/node": "^26.0.0",
|
|
85
91
|
"@types/react": "^19.2.17",
|
|
86
92
|
"ember-source": "^6.8.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-UnP87BCQ.mjs","names":["Application","ApplicationInstance","render","args","context","id","component","Error","contexts","Map","getAppOptions","opts","autoboot","buildAppInstance","application","create","buildInstance","isApplication","maybeApp","undefined","superclass","name","initApp","appOption","renderToCanvas","storyFn","showMain","storyContext","forceRemount","canvasElement","trackedObject","renderComponent","destroy","Component","unmount","element","get","delete","renderer","parameters","ember","app","rootElement","owner","key","obj","Object","entries","unregister","register","boot","trackedArgs","result","into","set"],"sources":["../src/client/render.ts"],"sourcesContent":["import Application from '@ember/application';\nimport ApplicationInstance from '@ember/application/instance';\n\nimport type { AppParamater, EmberRenderer, StoryContext } from './types';\nimport type { RenderResult } from '@ember/-internals/glimmer/lib/renderer';\nimport type { ArgsStoryFn, RenderContext } from 'storybook/internal/types';\n\ntype Args = Record<string, unknown>;\n\nexport const render: ArgsStoryFn<EmberRenderer> = (args, context) => {\n const { id, component } = context;\n\n if (typeof component === 'function') {\n return component;\n }\n\n if (typeof component === 'object') {\n return component;\n }\n\n throw new Error(\n `Unable to render story ${id} as the component annotation is missing from the default export`\n );\n};\n\nconst contexts = new Map<\n EmberRenderer['canvasElement'],\n {\n application: ApplicationInstance | undefined;\n renderer: RenderResult;\n args: Args;\n }\n>();\n\nfunction getAppOptions(opts: { rootElement: HTMLElement }) {\n return {\n ...opts,\n autoboot: false\n };\n}\n\nfunction buildAppInstance(application: typeof Application, opts: { rootElement: HTMLElement }) {\n return application.create(getAppOptions(opts)).buildInstance();\n}\n\nfunction isApplication(maybeApp: object): maybeApp is typeof Application {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n // @ts-expect-error well, ember types\n maybeApp.create !== undefined &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n maybeApp.superclass &&\n // @ts-expect-error well, ember types\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n maybeApp.superclass.name === 'EmberApp'\n );\n}\n\nfunction initApp(appOption: AppParamater, opts: { rootElement: HTMLElement }): ApplicationInstance {\n if (appOption instanceof ApplicationInstance) {\n return appOption;\n }\n\n if (isApplication(appOption)) {\n return buildAppInstance(appOption, opts);\n }\n\n // eslint-disable-next-line unicorn/no-useless-recursion\n return initApp(appOption(getAppOptions(opts)), opts);\n}\n\nexport async function renderToCanvas(\n {\n storyFn,\n showMain,\n storyContext,\n forceRemount\n }: RenderContext<EmberRenderer> & { storyContext: StoryContext },\n canvasElement: EmberRenderer['canvasElement']\n) {\n const { trackedObject } = await import('@ember/reactive/collections');\n const { renderComponent } = await import('@ember/renderer');\n const { destroy } = await import('@ember/destroyable');\n\n const args = storyContext.args;\n const Component = storyFn();\n\n function unmount(element: EmberRenderer['canvasElement']) {\n const context = contexts.get(element);\n\n if (!context) {\n return;\n }\n\n contexts.delete(element);\n context.renderer.destroy();\n\n if (context.application) {\n destroy(context.application);\n }\n }\n\n if (forceRemount) {\n unmount(canvasElement);\n }\n\n // this check does not work:\n // when globals are updated, that are interesting for a decorato\n // this check would prevent that update\n\n // const context = contexts.get(canvasElement);\n // if (context && !forceRemount && args) {\n // updateArgs(context.args, args);\n // return () => {\n // unmount(canvasElement);\n // };\n // }\n\n // find the ember app for the story\n let application: ApplicationInstance | undefined;\n\n if (storyContext.parameters.ember?.app) {\n const appOption = storyContext.parameters.ember.app;\n\n application = initApp(appOption, { rootElement: canvasElement });\n }\n\n application ??= buildAppInstance(Application, { rootElement: canvasElement });\n\n // modify the owner for the story\n if (storyContext.parameters.ember?.owner) {\n for (const [key, obj] of Object.entries(storyContext.parameters.ember.owner) as [\n `${string}:${string}`,\n object\n ][]) {\n application.unregister(key);\n application.register(key, obj);\n }\n }\n\n // boot the instance so ember registers necessary environments\n await application.boot();\n\n const trackedArgs = trackedObject({ ...args });\n const result = renderComponent(Component, {\n args: trackedArgs,\n into: canvasElement,\n owner: application\n });\n\n contexts.set(canvasElement, { application, renderer: result, args: trackedArgs });\n\n showMain();\n\n // eslint-disable-next-line unicorn/consistent-function-scoping\n return () => {\n // needs fix:\n // unmount(canvasElement);\n };\n}\n\n// function updateArgs(currentArgs: Args, nextArgs: Args) {\n// for (const key of Object.keys(currentArgs)) {\n// if (!(key in nextArgs)) {\n// delete currentArgs[key];\n// }\n// }\n\n// Object.assign(currentArgs, nextArgs);\n// }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,MAAaE,UAAsCC,MAAMC,YAAY;CACnE,MAAM,EAAEC,IAAIC,cAAcF;CAE1B,IAAI,OAAOE,cAAc,YACvB,OAAOA;CAGT,IAAI,OAAOA,cAAc,UACvB,OAAOA;CAGT,MAAM,IAAIC,MACR,0BAA0BF,GAAE,gEAC9B;AACF;AAEA,MAAMG,2BAAW,IAAIC,IAOnB;AAEF,SAASC,cAAcC,MAAoC;CACzD,OAAO;EACL,GAAGA;EACHC,UAAU;CACZ;AACF;AAEA,SAASC,iBAAiBC,aAAiCH,MAAoC;CAC7F,OAAOG,YAAYC,OAAOL,cAAcC,IAAI,CAAC,CAAC,CAACK,cAAc;AAC/D;AAEA,SAASC,cAAcC,UAAkD;CAEvE,OAEEA,SAASH,WAAWI,KAAAA,KAGpBD,SAASE,cAGTF,SAASE,WAAWC,SAAS;AAEjC;AAEA,SAASC,QAAQC,WAAyBZ,MAAyD;CACjG,IAAIY,qBAAqBtB,qBACvB,OAAOsB;CAGT,IAAIN,cAAcM,SAAS,GACzB,O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