@creadigme/aurelia-docgen
Version:
Aurelia + Storybook (can be) â¤. Aurelia documentation generator.
1 lines âĸ 90.4 kB
JavaScript
(()=>{"use strict";var __webpack_modules__={289:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{eval("// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n AureliaDocgen: () => (/* reexport */ AureliaDocgen),\n AureliaDocgenCLI: () => (/* reexport */ AureliaDocgenCLI),\n AureliaDocgenCLIOptions: () => (/* reexport */ AureliaDocgenCLIOptions)\n});\n\n// NAMESPACE OBJECT: ./src/services/helpers/typedoc-stories-helpers.ts\nvar typedoc_stories_helpers_namespaceObject = {};\n__webpack_require__.r(typedoc_stories_helpers_namespaceObject);\n__webpack_require__.d(typedoc_stories_helpers_namespaceObject, {\n encodeHTML: () => (encodeHTML),\n formatComment: () => (formatComment),\n getAndStripStories: () => (getAndStripStories),\n getExampleFromComment: () => (getExampleFromComment),\n kebabCase: () => (kebabCase),\n toArgType: () => (toArgType),\n typedocToArgType: () => (typedocToArgType)\n});\n\n;// CONCATENATED MODULE: external \"node:path\"\nconst external_node_path_namespaceObject = require(\"node:path\");\n;// CONCATENATED MODULE: external \"node:fs\"\nconst external_node_fs_namespaceObject = require(\"node:fs\");\n;// CONCATENATED MODULE: external \"js-yaml\"\nconst external_js_yaml_namespaceObject = require(\"js-yaml\");\n;// CONCATENATED MODULE: external \"eta\"\nconst external_eta_namespaceObject = require(\"eta\");\n;// CONCATENATED MODULE: ./src/services/helpers/kebab-case.ts\n/**\n * Kebab Case\n * @param word string\n * @returns string\n */\nfunction kebabCase(word) {\n if (word) {\n const newWord = word.replace(/[A-Z ]/g, s => (s !== ' ' ? '-' + s.toLowerCase() : ''));\n if (newWord.startsWith('-')) {\n return newWord.slice(1);\n }\n else {\n return newWord;\n }\n }\n else {\n return '';\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/helpers/typedoc-stories-helpers.ts\n/** Format TypeDoc Comment */\nfunction formatComment(comment, parameters, options = { mode: 'md' }) {\n if (comment) {\n let formatedComment = comment.summary.map(f => f.text).join('\\n');\n if (comment.label) {\n formatedComment += `\\n\\n${comment.label}`;\n }\n if (comment.blockTags.length) {\n formatedComment += `\\n\\n${comment.blockTags\n .map(f => {\n var _a;\n let tag = `đ **${f.tag.slice(1)}**`;\n if (((_a = f.content) === null || _a === void 0 ? void 0 : _a.length) && _formatTagComment.has(f.tag)) {\n tag += _formatTagComment.get(f.tag)(f, options);\n }\n return tag;\n })\n .join('<br>')}`;\n }\n if (parameters === null || parameters === void 0 ? void 0 : parameters.length) {\n formatedComment += `<br><br>**Parameters**<br>${parameters\n .map(f => {\n let tag = `${f.name}${f.flags.isOptional ? '?' : ''} \\`${f.type}\\`` + (f.defaultValue !== undefined ? `\\` = ${f.defaultValue}\\`` : '');\n if (f.comment) {\n const paramComment = formatComment(f.comment);\n tag += paramComment ? '<br>' + paramComment : '';\n }\n return `<span style=\"margin-left: 8px; display: block\">â ${tag}</span>`;\n })\n .join('<br>')}`;\n }\n if (comment.getTag('@returns')) {\n formatedComment += `<br><br>âŠī¸ **returns** \\`${comment.getTag('@returns')}\\`\\n<br>`;\n }\n return formatedComment;\n }\n else {\n return undefined;\n }\n}\n/** Easy formatting of special tags */\nconst _formatTagComment = new Map([\n [\n '@example',\n (comment, options) => {\n const text = comment.content.map(f => f.text).join('\\n');\n const isHTML = text.indexOf('```html') !== -1;\n if (isHTML || text.indexOf('```ts') !== -1 || text.indexOf('```typescript') !== -1) {\n if (options.mode === 'html') {\n // we are in a \"p\", we can't use pre or code\n return `\\n<br><span class=\"prismjs language-${isHTML ? 'html' : 'typescript'}\" style=\"padding: 8px;font-size: 12px;font-family: monospace;display: block;background: whitesmoke;border-radius: 8px;\">${encodeHTML(extractStory(text).code)}</span>`;\n }\n else {\n return '\\n' + text + '\\n';\n }\n }\n else {\n return `: ${encodeHTML(text)}`;\n }\n },\n ],\n]);\n/** Get example from comment */\nfunction getExampleFromComment(comment) {\n const commentTag = comment === null || comment === void 0 ? void 0 : comment.getTag('@example');\n if (commentTag) {\n const example = commentTag.content.map(f => f.text).join('\\n');\n if (example) {\n return extractStory(example).code;\n }\n }\n return '';\n}\n/** Get and strip stories from comment */\nfunction getAndStripStories(comment) {\n const stories = [];\n if (comment) {\n comment.blockTags.forEach(tag => {\n if (tag.tag === '@story') {\n stories.push(extractStory(tag.content.map(f => f.text).join('\\n')));\n }\n });\n comment.removeTags('@story');\n }\n return stories;\n}\n/**\n * Extract Stroy from comment tag\n * @param string comment\n * @returns AureliaDocgenStory\n */\nfunction extractStory(text) {\n const htmlCode = '```html';\n const tsCode = '```typescript';\n const tsCodeAlt = '```ts';\n let currentCode = '';\n let code = text;\n let title = '';\n currentCode = htmlCode;\n let start = text.indexOf(currentCode);\n if (start === -1) {\n currentCode = tsCode;\n start = text.indexOf(currentCode);\n if (start === -1) {\n currentCode = tsCodeAlt;\n start = text.indexOf(currentCode);\n }\n }\n let end = -1;\n if (start !== -1) {\n title = text.slice(0, start).trim();\n end = text.indexOf('```', start + currentCode.length);\n }\n if (start !== end) {\n code = text.slice(start + currentCode.length, end).trim();\n }\n return {\n title,\n code,\n help: currentCode + '\\n' + code + '\\n```\\n',\n };\n}\nconst _htmlTags = new Map([\n ['&', '&'],\n ['<', '<'],\n ['>', '>'],\n]);\n/** Encode HTML */\nfunction encodeHTML(html) {\n return html.replace(/[&<>]/g, tag => _htmlTags.get(tag));\n}\n/** Typedoc type to StoryBook argTypes */\nconst typedocToArgType = {\n boolean: propertyType => {\n return { type: 'boolean', control: 'boolean' };\n },\n number: propertyType => {\n return { type: 'number', control: { type: 'number', step: 1 } };\n },\n object: propertyType => {\n return { type: 'object', control: 'object' };\n },\n any: propertyType => {\n return { type: 'object', control: 'object' };\n },\n array: propertyType => {\n return { type: 'array', control: 'object' };\n },\n string: propertyType => {\n return { type: 'string', control: 'text' };\n },\n date: propertyType => {\n return { type: 'date', control: 'date' };\n },\n reflection: propertyType => {\n var _a;\n const method = propertyType.declaration;\n const methodComment = ((_a = method.signatures) === null || _a === void 0 ? void 0 : _a.length) && method.signatures[0].comment;\n const parameters = methodComment ? method.signatures[0].parameters : [];\n return { type: 'object', control: false, description: methodComment ? formatComment(methodComment, parameters) : undefined };\n },\n unknown: propertyType => {\n return { type: 'object', control: false };\n },\n union: (propertyType) => {\n const types = propertyType.types.map(f => f.value);\n return { type: typeof types[0], control: 'inline-radio', options: types };\n },\n reference: (propertyType) => {\n var _a;\n if (propertyType.name === 'Date' && propertyType.package === 'typescript') {\n return typedocToArgType.date(propertyType);\n }\n else if (propertyType.reflection) {\n if (((_a = propertyType.reflection.type) === null || _a === void 0 ? void 0 : _a.type) === 'union') {\n return typedocToArgType.union(propertyType.reflection.type);\n }\n else {\n return { type: 'object', control: false };\n }\n }\n else {\n return { type: 'object', control: true };\n }\n },\n};\nfunction toArgType(propertyType, control) {\n const type = (typeof propertyType === 'string' ? propertyType : propertyType.type === 'intrinsic' ? propertyType.name : propertyType.type).toLowerCase();\n if (type in typedocToArgType) {\n const argType = typedocToArgType[type](propertyType);\n if (control === false) {\n argType.control = false;\n }\n try {\n argType.original = JSON.parse(JSON.stringify(propertyType));\n }\n catch (_a) {\n argType.original = type;\n //\n }\n return argType;\n }\n else {\n return { type: 'object', control: false, original: type };\n }\n}\n\n\n;// CONCATENATED MODULE: ./src/services/helpers/path-utils.ts\n\n/** Create a relative path from a directory to a file */\nfunction buildRelativePath(fromDir, toFilePath) {\n return './' + external_node_path_namespaceObject.join(external_node_path_namespaceObject.relative(fromDir, external_node_path_namespaceObject.dirname(toFilePath)), external_node_path_namespaceObject.basename(toFilePath)).replace(/\\\\/g, '/');\n}\n/** Ensure absolute path */\nfunction ensureAbsolutePath(baseDir, dirOrFilePath) {\n if (external_node_path_namespaceObject.isAbsolute(dirOrFilePath)) {\n return external_node_path_namespaceObject.resolve(dirOrFilePath);\n }\n else {\n return external_node_path_namespaceObject.resolve(baseDir, dirOrFilePath);\n }\n}\n\n;// CONCATENATED MODULE: external \"typedoc\"\nconst external_typedoc_namespaceObject = require(\"typedoc\");\n;// CONCATENATED MODULE: external \"typescript\"\nconst external_typescript_namespaceObject = require(\"typescript\");\n;// CONCATENATED MODULE: ./src/services/typedoc/plugins/decorator-plugin.ts\n/** Code from TypeDoc 0.22.18 - Edited */\n\n\nclass DecoratorPlugin {\n constructor(_app) {\n this._app = _app;\n this.usages = new Map();\n //\n this._onDeclarationBound = this.onDeclaration.bind(this);\n this._onBeginResolveBound = this.onBeginResolve.bind(this);\n this._usageClearBound = () => this.usages.clear();\n }\n /**\n * Create a new ImplementsPlugin instance.\n */\n register() {\n this._app.converter.on(external_typedoc_namespaceObject.Converter.EVENT_CREATE_DECLARATION, this._onDeclarationBound);\n this._app.converter.on(external_typedoc_namespaceObject.Converter.EVENT_CREATE_PARAMETER, this._onDeclarationBound);\n this._app.converter.on(external_typedoc_namespaceObject.Converter.EVENT_RESOLVE, this._onBeginResolveBound);\n this._app.converter.on(external_typedoc_namespaceObject.Converter.EVENT_END, this._usageClearBound);\n }\n // /**\n // * Dispose\n // */\n // public dispose(): void {\n // this._app.converter.off(Converter.EVENT_CREATE_DECLARATION, this._onDeclarationBound);\n // this._app.converter.off(Converter.EVENT_CREATE_PARAMETER, this._onDeclarationBound);\n // this._app.converter.off(Converter.EVENT_RESOLVE, this._onBeginResolveBound);\n // this._app.converter.off(Converter.EVENT_END, this._usageClearBound);\n // }\n /**\n * Create an object describing the arguments a decorator is set with.\n *\n * @param args The arguments resolved from the decorator's call expression.\n * @param signature The signature definition of the decorator being used.\n * @returns An object describing the decorator parameters,\n */\n extractArguments(args, signature) {\n const result = {};\n args.forEach((arg, index) => {\n if (index < signature.parameters.length) {\n const parameter = signature.parameters[index];\n result[parameter.name] = arg.getText();\n }\n else {\n if (!result['...']) {\n result['...'] = [];\n }\n result['...'].push(arg.getText());\n }\n });\n return result;\n }\n /**\n * Triggered when the converter has created a declaration or signature reflection.\n *\n * @param context The context object describing the current state the converter is in.\n * @param reflection The reflection that is currently processed.\n * @param node The node that is currently processed if available.\n */\n onDeclaration(context, reflection, node) {\n var _a;\n const symbol = reflection.project.getSymbolFromReflection(reflection);\n for (const node of (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || []) {\n (_a = external_typescript_namespaceObject.getDecorators(node)) === null || _a === void 0 ? void 0 : _a.forEach(decorator => {\n var _a, _b;\n let callExpression;\n let identifier;\n switch (decorator.expression.kind) {\n case external_typescript_namespaceObject.SyntaxKind.Identifier:\n identifier = decorator.expression;\n break;\n case external_typescript_namespaceObject.SyntaxKind.CallExpression:\n callExpression = decorator.expression;\n identifier = callExpression.expression;\n break;\n default:\n return;\n }\n const info = {\n name: identifier.getText(),\n };\n const type = context.checker.getTypeAtLocation(identifier);\n if (type && type.symbol) {\n info.type = external_typedoc_namespaceObject.ReferenceType.createSymbolReference(context.resolveAliasedSymbol(type.symbol), context, info.name);\n if (callExpression && callExpression.arguments) {\n const signature = context.checker.getResolvedSignature(callExpression);\n if (signature) {\n info.arguments = this.extractArguments(callExpression.arguments, signature);\n }\n }\n const usages = (_a = this.usages.get(type.symbol)) !== null && _a !== void 0 ? _a : [];\n usages.push(external_typedoc_namespaceObject.ReferenceType.createResolvedReference(reflection.name, reflection, context.project));\n this.usages.set(type.symbol, usages);\n }\n (_b = reflection.decorators) !== null && _b !== void 0 ? _b : (reflection.decorators = []);\n reflection.decorators.push(info);\n });\n }\n }\n onBeginResolve(context) {\n for (const [symbol, ref] of this.usages) {\n const reflection = context.project.getReflectionFromSymbol(symbol);\n if (reflection) {\n reflection.decorates = ref;\n }\n }\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/typedoc/log/mini-logger.ts\n\nclass MiniLogger extends external_typedoc_namespaceObject.Logger {\n constructor(_options) {\n super();\n this._options = _options;\n }\n /**\n * Print a log message.\n *\n * @param _message The message itself.\n * @param level The urgency of the log message.\n */\n log(_message, level) {\n if (level > 0 || this._options.verbose) {\n this._options.logger(_message, level);\n }\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/typedoc/typedoc-manager.ts\n\n// import { getDecorators } from 'typescript';\n\n\n/** Typedoc Manager */\nclass TypedocManager {\n constructor(_options) {\n this._options = _options;\n this._typedoc = new external_typedoc_namespaceObject.Application();\n this._typedoc.options.addReader(new external_typedoc_namespaceObject.TSConfigReader());\n this._typedoc.logger = new MiniLogger(this._options);\n this._typedoc.bootstrap({\n tsconfig: this._options.tsConfigPath,\n exclude: ['**/*.{spec,e2e,stories}.ts'],\n entryPointStrategy: 'Expand',\n excludeExternals: true,\n // skipErrorChecking: true,\n excludeInternal: true,\n excludePrivate: true,\n readme: 'none',\n disableSources: true,\n logLevel: this._options.verbose ? 'Verbose' : 'Warn',\n excludeProtected: true,\n entryPoints: [this._options.srcDir],\n });\n this._patchDefaultValue();\n this._decoratorPlugin = new DecoratorPlugin(this._typedoc);\n this._decoratorPlugin.register();\n }\n /**\n * By default, Typedoc replace complex defaultValue by '...'\n *\n * This code is based on sample of Gerrit0 in this issue:\n * https://github.com/TypeStrong/typedoc/issues/1393\n */\n _patchDefaultValue() {\n const defaultValues = new Map();\n const printer = external_typedoc_namespaceObject.TypeScript.createPrinter({ removeComments: true, omitTrailingSemicolon: true });\n this._typedoc.converter.on(external_typedoc_namespaceObject.Converter.EVENT_CREATE_DECLARATION, (_context, reflection, node) => {\n const symbol = reflection.project.getSymbolFromReflection(reflection);\n for (const node of (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || []) {\n if (node.initializer) {\n const defaultValue = printer.printNode(external_typedoc_namespaceObject.TypeScript.EmitHint.Expression, node.initializer, node.getSourceFile());\n // Ignore PropertyAccessExpression (property = MyClass.anotherProperty)\n if (node.initializer.kind !== external_typedoc_namespaceObject.TypeScript.SyntaxKind.PropertyAccessExpression) {\n defaultValues.set(reflection, defaultValue);\n }\n else {\n defaultValues.set(reflection, undefined);\n }\n }\n }\n });\n this._typedoc.converter.on(external_typedoc_namespaceObject.Converter.EVENT_RESOLVE_BEGIN, function () {\n for (const [refl, init] of defaultValues) {\n refl.defaultValue = init;\n }\n defaultValues.clear();\n });\n }\n /** Convert */\n convert() {\n return this._typedoc.convert();\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/base/base-declaration.ts\n\nclass BaseDeclaration {\n /** Parent */\n get parent() {\n return this.original.parent;\n }\n /** Original name */\n get name() {\n return this.original.name;\n }\n /** Original comment */\n get comment() {\n return this.original.comment;\n }\n constructor(original, auType) {\n var _a, _b, _c;\n this.original = original;\n this.auType = auType;\n /** Public methods */\n this.publicMethods = [];\n /** Properties (without bindables) */\n this.properties = [];\n /** Bindables properties */\n this.bindables = [];\n this._fillTag();\n // Embedded stories\n this.stories = getAndStripStories(original.comment);\n (_a = this.original.children) === null || _a === void 0 ? void 0 : _a.forEach((f) => {\n var _a;\n if (f.flags.isPublic && !f.flags.isStatic) {\n if (f.kind === 2048) {\n // methods\n this.publicMethods.push(f);\n }\n else if (f.kind === 1024) {\n // Properties\n if ((_a = f.decorators) === null || _a === void 0 ? void 0 : _a.find(f => f.name === 'bindable')) {\n this.bindables.push(f);\n }\n else {\n this.properties.push(f);\n }\n }\n }\n });\n // Store main category (if specified)\n const parent = this.parent;\n this.category = undefined;\n if (((_b = parent === null || parent === void 0 ? void 0 : parent.groups) === null || _b === void 0 ? void 0 : _b.length) && ((_c = parent.groups[0].categories) === null || _c === void 0 ? void 0 : _c.length)) {\n this.category = parent.groups[0].categories[0].title;\n }\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/base/decorator-declaration.ts\n\nclass DecoratorDeclaration extends BaseDeclaration {\n constructor(declaration, auType) {\n super(declaration, auType);\n }\n /** Fill tag name for decorator */\n _fillTag() {\n const decorator = this.original.decorators.find(f => f.name === this.auType);\n const decoratorArgs = decorator.arguments;\n if (decoratorArgs.name) {\n this.tag = decoratorArgs.name.slice(1, -1);\n }\n else {\n // \"{\\n name: 'ra-modal',\\n template: tpl,\\n}\"\n this.tag = /name: '([\\w\\-]*)'/.exec(decoratorArgs.definition)[1];\n }\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/eligible/binding-behavior-declaration.ts\n\n/**\n * `@bindingBehavior` declaration\n */\nclass BindingBehaviorDeclaration extends DecoratorDeclaration {\n constructor(declaration) {\n super(declaration, 'bindingBehavior');\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/eligible/custom-attribute-declaration.ts\n\n/**\n * `@customAttribute` declaration\n */\nclass CustomAttributeDeclaration extends DecoratorDeclaration {\n constructor(declaration) {\n super(declaration, 'customAttribute');\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/eligible/custom-element-declaration.ts\n\n/**\n * `@customElement` declaration\n */\nclass CustomElementDeclaration extends DecoratorDeclaration {\n constructor(declaration) {\n super(declaration, 'customElement');\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/base/tag-comment-au-parser.ts\n\nclass TagCommentDeclaration extends BaseDeclaration {\n constructor(declaration, auType) {\n super(declaration, auType);\n }\n _fillTag() {\n this.tag = this.original.name;\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/eligible/service-declaration.ts\n\n/**\n * Tag comment `@service` declaration\n */\nclass ServiceDeclaration extends TagCommentDeclaration {\n constructor(declaration) {\n super(declaration, 'service');\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/eligible/value-converter-declaration.ts\n\n/**\n * `@valueConverter` declaration\n */\nclass ValueConverterDeclaration extends DecoratorDeclaration {\n constructor(declaration) {\n super(declaration, 'valueConverter');\n }\n}\n\n;// CONCATENATED MODULE: ./src/services/declaration/declaration-factory.ts\n\n\n\n\n\n\nconst storyElementDecorators = new Set(['customElement', 'valueConverter', 'customAttribute', 'bindingBehavior']);\nconst storyElementTagComments = new Set(['@service']);\nconst storyElementFactory = {\n customElement: declaration => new CustomElementDeclaration(declaration),\n valueConverter: declaration => new ValueConverterDeclaration(declaration),\n customAttribute: declaration => new CustomAttributeDeclaration(declaration),\n bindingBehavior: declaration => new BindingBehaviorDeclaration(declaration),\n '@service': declaration => new ServiceDeclaration(declaration),\n};\n/** Get any eligible declaration */\nfunction getEligibleDeclaration(declaration) {\n var _a;\n if (declaration.kind === external_typedoc_namespaceObject.ReflectionKind.Class) {\n const decorators = declaration.decorators || [];\n // By decorator ?\n const decorator = decorators.find(f => storyElementDecorators.has(f.name));\n if (decorator) {\n return storyElementFactory[decorator.name](declaration);\n }\n // By tag comment ?\n const tagComment = (_a = declaration.comment) === null || _a === void 0 ? void 0 : _a.blockTags.find(f => storyElementTagComments.has(f.tag));\n if (tagComment) {\n return storyElementFactory[tagComment.tag](declaration);\n }\n }\n return null;\n}\n\n;// CONCATENATED MODULE: ./src/services/aurelia-docgen.ts\n\n\n\n\n\n\n\n\n/**\n * Aurelia Docgen\n */\nclass AureliaDocgen {\n constructor(_options) {\n this._options = _options;\n this.projectDir = this._options.projectDir || process.cwd();\n this.srcDir = external_node_path_namespaceObject.resolve(this.projectDir, 'src');\n if (this._options.out) {\n this.outDir = ensureAbsolutePath(this.projectDir, this._options.out);\n this.mergeOut = !!this._options.mergeOut;\n }\n this._auConfigure = this._options.auConfigure ? ensureAbsolutePath(this.projectDir, this._options.auConfigure) : undefined;\n this._tplPath = this._options.etaTemplate ? external_node_path_namespaceObject.resolve(this._options.etaTemplate) : external_node_path_namespaceObject.join(__dirname, true ? './' : 0, 'static/templates/au2.stories.ts.eta');\n this._defaultLogger = this._options.logger || ((msg, level) => console.log(`${level} - ${msg}`));\n // Typedoc manger\n this._typedocManager = new TypedocManager({\n logger: this._defaultLogger,\n srcDir: this.srcDir,\n tsConfigPath: external_node_path_namespaceObject.join(this.projectDir, 'tsconfig.json'),\n verbose: this._options.verbose,\n });\n this._eta = new external_eta_namespaceObject.Eta();\n this._init();\n }\n _init() {\n this._tpl = external_node_fs_namespaceObject.readFileSync(this._tplPath, 'utf8');\n }\n /** Get stories from TS project */\n *getStories() {\n // Phase 1: TypeDoc\n const projectReflection = this._typedocManager.convert();\n if (projectReflection) {\n // Phase 2: Search and format components\n for (const component of this._getEligibleDeclarations(projectReflection)) {\n yield this._buildElementStory(component);\n }\n }\n }\n _buildElementStory(baseDeclaration) {\n const componentPathWOE = external_node_path_namespaceObject.join(this.srcDir, baseDeclaration.original.parent.name);\n const ymlStoriesPath = componentPathWOE + '.stories.yml';\n const ymlStories = external_node_fs_namespaceObject.existsSync(ymlStoriesPath) ? external_js_yaml_namespaceObject.load(external_node_fs_namespaceObject.readFileSync(ymlStoriesPath, 'utf-8')) : [];\n return {\n component: baseDeclaration,\n componentPath: componentPathWOE,\n stories: this._eta.renderString(this._tpl, {\n importPath: this.outDir ? buildRelativePath(this.outDir, componentPathWOE) : './' + external_node_path_namespaceObject.basename(baseDeclaration.original.parent.name),\n registry: {\n import: 'configure',\n path: this._auConfigure ? buildRelativePath(this.outDir || external_node_path_namespaceObject.dirname(componentPathWOE), this._auConfigure) : undefined,\n },\n component: baseDeclaration,\n stories: baseDeclaration.stories.concat(ymlStories),\n helpers: typedoc_stories_helpers_namespaceObject,\n }),\n };\n }\n /** Get customElement, valueConverters, etc recursively */\n *_getEligibleDeclarations(element, parent) {\n if (!element.parent) {\n // Ensure parent element\n element.parent = parent;\n }\n const eligibleDeclaration = getEligibleDeclaration(element);\n if (eligibleDeclaration) {\n yield eligibleDeclaration;\n }\n else if (element.children) {\n for (const child of element.children) {\n yield* this._getEligibleDeclarations(child, element);\n }\n }\n }\n}\n\n;// CONCATENATED MODULE: external \"chokidar\"\nconst external_chokidar_namespaceObject = require(\"chokidar\");\n;// CONCATENATED MODULE: ./src/models/aurelia-docgen-options.ts\n/**\n * Aurelia Docgen Options\n * CommandLines definitions\n */\nconst AureliaDocgenCLIOptions = [\n { name: 'verbose', alias: 'v', type: Boolean },\n { name: 'projectDir', alias: 'i', type: String },\n { name: 'out', alias: 'o', type: String },\n { name: 'mergeOut', alias: 'm', type: Boolean },\n { name: 'etaTemplate', alias: 't', type: String },\n { name: 'auConfigure', type: String },\n { name: 'watch', type: Boolean },\n];\n\n;// CONCATENATED MODULE: external \"command-line-args\"\nconst external_command_line_args_namespaceObject = require(\"command-line-args\");\nvar external_command_line_args_default = /*#__PURE__*/__webpack_require__.n(external_command_line_args_namespaceObject);\n;// CONCATENATED MODULE: external \"node:worker_threads\"\nconst external_node_worker_threads_namespaceObject = require(\"node:worker_threads\");\n;// CONCATENATED MODULE: external \"ansi-colors\"\nconst external_ansi_colors_namespaceObject = require(\"ansi-colors\");\n;// CONCATENATED MODULE: ./src/services/aurelia-docgen-cli.ts\n\n\n\n\n\n\n\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { name: aurelia_docgen_cli_name } = __webpack_require__(147);\n/**\n * Aurelia Docgen CLI\n */\nclass AureliaDocgenCLI {\n constructor() {\n var _a;\n const options = ((_a = (external_command_line_args_default())[\"default\"]) !== null && _a !== void 0 ? _a : (external_command_line_args_default()))(AureliaDocgenCLIOptions);\n this._aureliaDocgen = new AureliaDocgen(options);\n this._outExtension = options.etaTemplate ? external_node_path_namespaceObject.extname(options.etaTemplate.slice(0, -4)) : '.ts';\n this.mustWatch = !!options.watch;\n }\n /** Write stories */\n writeStories() {\n this._ensureOutDir();\n const outDir = this._aureliaDocgen.outDir;\n if (this._aureliaDocgen.mergeOut) {\n const outPath = external_node_path_namespaceObject.join(outDir, `components.stories${this._outExtension}`);\n external_node_fs_namespaceObject.writeFileSync(outPath, '', 'utf-8');\n for (const ceStories of this._aureliaDocgen.getStories()) {\n external_node_fs_namespaceObject.appendFileSync(outPath, ceStories.stories, 'utf-8');\n }\n }\n else {\n for (const ceStories of this._aureliaDocgen.getStories()) {\n external_node_fs_namespaceObject.writeFileSync(outDir ? external_node_path_namespaceObject.join(outDir, `${ceStories.component.tag}.stories${this._outExtension}`) : ceStories.componentPath + `.stories${this._outExtension}`, ceStories.stories, 'utf-8');\n }\n }\n AureliaDocgenCLI._sendMessage(AureliaDocgenCLI.MSG_WRITE_STORIES_DONE);\n }\n /** Watch and write stories */\n watchStories() {\n // Initial\n this.writeStories();\n // debounce\n let tokenTimeout;\n const fsWatcher = external_chokidar_namespaceObject.watch(this._aureliaDocgen.srcDir, {\n awaitWriteFinish: true,\n disableGlobbing: true,\n ignoreInitial: true,\n })\n .on('ready', () => {\n AureliaDocgenCLI._sendMessage(AureliaDocgenCLI.MSG_WATCHING);\n })\n .on('all', (eventName, fpath, stat) => {\n if (AureliaDocgenCLI._RE_WATCH_EVENT.test(eventName) && (!stat || stat.isFile()) && !AureliaDocgenCLI._RE_WATCH_IGNORE.test(fpath)) {\n // Debounce writeStories\n if (tokenTimeout) {\n clearTimeout(tokenTimeout);\n tokenTimeout = undefined;\n }\n tokenTimeout = setTimeout(() => {\n console.log((0,external_ansi_colors_namespaceObject.blueBright)(`[${aurelia_docgen_cli_name}] ${eventName} - ${fpath}`));\n try {\n this.writeStories();\n }\n catch (error) {\n AureliaDocgenCLI._sendMessage(AureliaDocgenCLI.MSG_WRITE_STORIES_FAIL);\n console.log((0,external_ansi_colors_namespaceObject.redBright)(`[${aurelia_docgen_cli_name}] Writing stories failed: ${error.message}`));\n }\n }, 500);\n }\n });\n return fsWatcher;\n }\n /** Ensure output directory */\n _ensureOutDir() {\n const outDir = this._aureliaDocgen.outDir;\n if (outDir) {\n // ensure out dir\n if (!external_node_fs_namespaceObject.existsSync(outDir)) {\n external_node_fs_namespaceObject.mkdirSync(outDir, {\n recursive: true,\n });\n }\n }\n }\n static _sendMessage(message) {\n if (external_node_worker_threads_namespaceObject.parentPort === null || external_node_worker_threads_namespaceObject.parentPort === void 0 ? void 0 : external_node_worker_threads_namespaceObject.parentPort.postMessage) {\n external_node_worker_threads_namespaceObject.parentPort.postMessage(message);\n }\n else if (process.send) {\n process.send(message);\n }\n }\n}\nAureliaDocgenCLI.MSG_WRITE_STORIES_DONE = 'aurelia-docgen:write-stories:done';\nAureliaDocgenCLI.MSG_WRITE_STORIES_FAIL = 'aurelia-docgen:write-stories:failed';\nAureliaDocgenCLI.MSG_WATCHING = 'aurelia-docgen:watching';\nAurelia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lmIChjb21tZW50KSB7XG4gICAgICAgIGxldCBmb3JtYXRlZENvbW1lbnQgPSBjb21tZW50LnN1bW1hcnkubWFwKGYgPT4gZi50ZXh0KS5qb2luKCdcXG4nKTtcbiAgICAgICAgaWYgKGNvbW1lbnQubGFiZWwpIHtcbiAgICAgICAgICAgIGZvcm1hdGVkQ29tbWVudCArPSBgXFxuXFxuJHtjb21tZW50LmxhYmVsfWA7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGNvbW1lbnQuYmxvY2tUYWdzLmxlbmd0aCkge1xuICAgICAgICAgICAgZm9ybWF0ZWRDb21tZW50ICs9IGBcXG5cXG4ke2NvbW1lbnQuYmxvY2tUYWdzXG4gICAgICAgICAgICAgICAgLm1hcChmID0+IHtcbiAgICAgICAgICAgICAgICB2YXIgX2E7XG4gICAgICAgICAgICAgICAgbGV0IHRhZyA9IGDwn5SWICoqJHtmLnRhZy5zbGljZSgxKX0qKmA7XG4gICAgICAgICAgICAgICAgaWYgKCgoX2EgPSBmLmNvbnRlbnQpID09PSBudWxsIHx8IF9hID09PSB2b2lkIDAgPyB2b2lkIDAgOiBfYS5sZW5ndGgpICYmIF9mb3JtYXRUYWdDb21tZW50LmhhcyhmLnRhZykpIHtcbiAgICAgICAgICAgICAgICAgICAgdGFnICs9IF9mb3JtYXRUYWdDb21tZW50LmdldChmLnRhZykoZiwgb3B0aW9ucyk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiB0YWc7XG4gICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgIC5qb2luKCc8YnI+Jyl9YDtcbiAgICAgICAgfVxuICAgICAgICBpZiAocGFyYW1ldGVycyA9PT0gbnVsbCB8fCBwYXJhbWV0ZXJzID09PSB2b2lkIDAgPyB2b2lkIDAgOiBwYXJhbWV0ZXJzLmxlbmd0aCkge1xuICAgICAgICAgICAgZm9ybWF0ZWRDb21tZW50ICs9IGA8YnI+PGJyPioqUGFyYW1ldGVycyoqPGJyPiR7cGFyYW1ldGVyc1xuICAgICAgICAgICAgICAgIC5tYXAoZiA9PiB7XG4gICAgICAgICAgICAgICAgbGV0IHRhZyA9IGAke2YubmFtZX0ke2YuZmxhZ3MuaXNPcHRpb25hbCA/ICc/JyA6ICcnfSBcXGAke2YudHlwZX1cXGBgICsgKGYuZGVmYXVsdFZhbHVlICE9PSB1bmRlZmluZWQgPyBgXFxgID0gJHtmLmRlZmF1bHRWYWx1ZX1cXGBgIDogJycpO1xuICAgICAgICAgICAgICAgIGlmIChmLmNvbW1lbnQpIHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcGFyYW1Db21tZW50ID0gZm9ybWF0Q29tbWVudChmLmNvbW1lbnQpO1xuICAgICAgICAgICAgICAgICAgICB0YWcgKz0gcGFyYW1Db21tZW50ID8gJzxicj4nICsgcGFyYW1Db21tZW50IDogJyc7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBgPHNwYW4gc3R5bGU9XCJtYXJnaW4tbGVmdDogOHB4OyBkaXNwbGF5OiBibG9ja1wiPuKamSAke3RhZ308L3NwYW4+YDtcbiAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgLmpvaW4oJzxicj4nKX1gO1xuICAgICAgICB9XG4gICAgICAgIGlmIChjb21tZW50LmdldFRhZygnQHJldHVybnMnKSkge1xuICAgICAgICAgICAgZm9ybWF0ZWRDb21tZW50ICs9IGA8YnI+PGJyPuKGqe+4jyAqKnJldHVybnMqKiBcXGAke2NvbW1lbnQuZ2V0VGFnKCdAcmV0dXJucycpfVxcYFxcbjxicj5gO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBmb3JtYXRlZENvbW1lbnQ7XG4gICAgfVxuICAgIGVsc2Uge1xuICAgICAgICByZXR1cm4gdW5kZWZpbmVkO1xuICAgIH1cbn1cbi8qKiBFYXN5IGZvcm1hdHRpbmcgb2Ygc3BlY2lhbCB0YWdzICovXG5jb25zdCBfZm9ybWF0VGFnQ29tb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