@knapsack/renderer-react 4.70.0--canary.3797.b249674.0 → 4.70.0--canary.4821.56b0218.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/client/init.js +66 -15
- package/dist/client/init.js.map +1 -1
- package/dist/client/init.mjs +71 -10
- package/dist/client/init.mjs.map +1 -1
- package/dist/demo-wrapper.d.mts +1 -2
- package/dist/demo-wrapper.d.ts +1 -2
- package/dist/demo-wrapper.js +27 -7
- package/dist/demo-wrapper.js.map +1 -1
- package/dist/demo-wrapper.mjs +9 -5
- package/dist/demo-wrapper.mjs.map +1 -1
- package/dist/error-catcher.js +94 -28
- package/dist/error-catcher.js.map +1 -1
- package/dist/error-catcher.mjs +66 -6
- package/dist/error-catcher.mjs.map +1 -1
- package/dist/index.d.mts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +1283 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1292 -37
- package/dist/index.mjs.map +1 -1
- package/dist/prototype-template.js +26 -5
- package/dist/prototype-template.js.map +1 -1
- package/dist/prototype-template.mjs +8 -3
- package/dist/prototype-template.mjs.map +1 -1
- package/dist/types-CivTHEEo.d.mts +10 -0
- package/dist/types-CivTHEEo.d.ts +10 -0
- package/package.json +13 -13
- package/dist/types-D2eCZXsg.d.mts +0 -13
- package/dist/types-D2eCZXsg.d.ts +0 -13
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/renderer-react.ts","../src/utils.ts","../src/react-creators.ts","../src/types.ts"],"names":["renderUsageTemplate","templateName","attributes","children","__name","demoAppName","renderDemoAppTemplate","imports","getUsage","data","props","key","value","extraProps","extraAttributes","slotProps","values","result","formatCode","code","getDemoAppUsage","format","getTypeScriptInfoFromFile","src","tsConfigPath","findUp","path","rdTs","config","extractSpecFromTypeScriptInfo","results","exportName","spec","r","propName","propDef","name","description","defaultValue","required","type","parent","removeWrappingDoubleQuotes","options","enumItem","isNumberProp","error","log","getPropTypesInfoFromFile","reactDocs","builtinResolvers","fileSrc","readFile","FindExportedDefinitionsResolver","extractSpecFromPropTypesInfo","cleanUpSpec","prop","isOptionsProp","getReactModuleInfoUncached","unknownSrc","resolveFromDir","typesInfo","resolvePath","typeScriptInfo","jsInfo","ext","getReactModuleInfoCache","clearInferSpecCache","getReactModuleInfo","args","cacheKey","getReactSpec","reactModuleInfo","getReactDocs","opt","copyReactAssets","distDirAbsolute","publicPath","reactVersion","getModulePkgJson","reactDomVersion","reactRoot","__require","reactDomRoot","copy","reactFileSuffix","isCapitalLetter","char","startsWithCapitalLetter","str","createPatternData","importName","id","title","pkgPath","initialDemoId","createReactPattern","createCreator","importPrefix","dataDir","currentReactPatternsImportNames","readKsPatternConfigs","cur","pattern","reactTemplates","t","allImports","getJsExportNames","_","task","tasks","importNames","patterns","patternId","__","subTask","initialDemo","makeShortId","writeDemo","writeKsPatternConfig","byId","readKsNavConfig","componentsGroup","addKsNavItems","rendererMetaScriptTagId","pkg","findUpPkgJson","KnapsackReactRenderer","_KnapsackReactRenderer","RendererWebpackBase","webpackConfig","demoWrapperPath","join","rendererIds","disableReactStrictMode","fileExists","pascalCase","usage","demoApp","xImports","template","demo","extraImports","imp","isDeclaredVarsUnique","nameCollisions","meta","i","errorHtmlMsg","babelCodeForBrowser","e","html","asset","waits","templateDemoPath","attempt","absolutePath","exists","waitTime","sleep","templateFileContents","importCode","demoAppUsage","patternManifest","slots","slotsOptionsComputed","importInfo","importInfos","slotNames","slotName","slotItems","slotItemsUsages","slotItem","slotPattern","slotTemplate","slotOptionsComputed","openTag","closeTag","createSlotOptionsHtmlTags","templatePath","totalProps","totalSlots","knapsackEvents","files","schema","info","typeDefs","metaDir","file","base","parse","templateId","isFirst","exportNameWithTemplateId","relative","newPath","allTemplateDemos","allTemplates","usedSuggestions","alias","allPaths","exports","errorMsg","isFirstLetterCapital","s","us"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA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F,2BAAiB,CACnD,IAAA,CAAAjF,EACA,cAAgByE,CAAAA,CAAAA,CAChB,eAAgB,IAAK,CAAA,cACvB,CAAC,CACD,CAAA,GAAIuG,EACF,MAAM,IAAI,MAAMA,CAAQ,CAAA,CAE1B,OACED,CAGG,CAAA,MAAA,CAAQnD,GAAMA,CAAM,GAAA,SAAA,EAAaqD,2BAAqBrD,CAAC,CAAC,EACxD,GAAKlH,CAAAA,CAAAA,GAAU,CACd,KAAOA,CAAAA,CAAAA,CACP,KAAAV,CACF,CAAA,CAAE,CAER,CAAS4H,MAAAA,CAAAA,CAAG,CAEV,OAAAvG,OAAAA,CAAI,QACF,CAAkCrB,+BAAAA,EAAAA,CAAI,KAAK4H,CAAE,CAAA,OAAO,GACpD,IACA,CAAA,IAAA,CAAK,SACP,CACO,CAAA,EACT,CACF,CAAC,CACH,CAAE,CAAA,IAAA,CAAMxH,GAECA,CAAQ,CAAA,IAAA,EAChB,CAEkC,EAAA,MAAA,CAAQ8K,GAClC,CAACN,CAAAA,CAAgB,KACrBO,CAAOA,EAAAA,CAAAA,CAAG,QAAUD,CAAE,CAAA,KAAA,EAASC,EAAG,IAASD,GAAAA,CAAAA,CAAE,IAChD,CACD,CAID,CACF,CAAA,CAhE6D,wBAiE/D,CAAA","file":"index.js","sourcesContent":["import sleep from 'sleep-promise';\nimport {\n RendererWebpackBase,\n Renderer,\n type KsJsImport,\n} from '@knapsack/renderer-webpack-base';\nimport { pascalCase, isFirstLetterCapital } from '@knapsack/utils';\nimport { knapsackEvents, log } from '@knapsack/app';\nimport {\n Renderable,\n babelCodeForBrowser,\n createSlotOptionsHtmlTags,\n} from '@knapsack/app/renderers';\nimport {\n KnapsackFile,\n KnapsackPatternTemplate,\n KsTemplateSpec,\n TemplateSuggestion,\n rendererIds,\n RendererId,\n} from '@knapsack/types';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\nimport {\n exists as fileExists,\n findUpPkgJson,\n getJsExportNames,\n readFile,\n formatCode,\n} from '@knapsack/file-utils';\nimport { join, relative, parse } from 'path';\nimport {\n clearInferSpecCache,\n copyReactAssets,\n demoAppName,\n getDemoAppUsage,\n getReactDocs,\n getUsage,\n} from './utils';\nimport { createReactPattern } from './react-creators';\nimport { KsReactMeta, rendererMetaScriptTagId } from './types';\n\nconst { pkg } = findUpPkgJson(__dirname);\n// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\nlog.setupUpdateNotifier({ ...pkg, name: pkg.name!, version: pkg.version! });\n\nexport class KnapsackReactRenderer\n extends RendererWebpackBase\n implements Renderable\n{\n /**\n * `react.js` & `react-dom.js` root relative paths\n */\n assets: string[];\n babelConfig: Record<string, unknown>;\n private demoWrapperPath: string;\n\n private disableReactStrictMode?: boolean;\n\n constructor({\n webpackConfig,\n demoWrapperPath = join(__dirname, './demo-wrapper.mjs'),\n id = rendererIds.react,\n disableReactStrictMode,\n }: {\n webpackConfig?: ConstructorParameters<\n typeof RendererWebpackBase\n >[0]['webpackConfig'];\n demoWrapperPath?: string;\n /** When using React v18+, this option allows a workspace to _disable_ React's Strict Mode from running in Knapsack's React Renderer (StrictMode is enabled by default).\n *\n * See https://reactjs.org/docs/strict-mode.html for more info\n * */\n disableReactStrictMode?: boolean;\n /** Don't set if calling from `knapsack.config.js`, only use if creating a new Renderer based on the React Renderer */\n id?: RendererId;\n } = {}) {\n super({\n id,\n extension: '.jsx',\n language: 'jsx',\n webpackConfig,\n extraScripts: [\n // this is the code in `./client/init.mts`\n '@knapsack/renderer-react/client',\n ],\n });\n this.language = 'jsx';\n this.assets = [];\n this.demoWrapperPath = demoWrapperPath;\n\n // Half-borrowing the API Synax for this from the latest version of Next.js\n this.disableReactStrictMode = disableReactStrictMode;\n this.creators = [createReactPattern];\n }\n\n override init: Renderer['init'] = async (opt) => {\n await super.init(opt);\n this.assets = await copyReactAssets(this.outputDir, this.publicPath);\n if (!(await fileExists(this.demoWrapperPath))) {\n throw new Error(\n `Could not find demo wrapper at: \"${this.demoWrapperPath}\"`,\n );\n }\n };\n\n getMeta: Renderer['getMeta'] = () => ({\n id: this.id,\n title: 'React',\n aliasUse: 'optional',\n aliasTitle: 'Named Export',\n aliasIsJsNamedExport: true,\n aliasDescription:\n 'If `export X` was used instead of `export default`, then provide X.',\n enableDataDemos: true,\n enableTemplateDemos: true,\n hasSlotsSupport: true,\n hasSlotOptionsSupport: true,\n version: pkg.version,\n hasInferSpecSupport: true,\n syntaxHighlightingLanguage: 'jsx',\n hasTemplateSuggestionsSupport: true,\n prototypingTemplate: {\n path: '@knapsack/renderer-react/prototype-template',\n spec: {\n isInferred: false,\n props: {\n type: 'object',\n properties: {},\n },\n slots: {\n children: { title: 'Children' },\n },\n },\n },\n });\n\n override changeCase: Renderer['changeCase'] = (str) => pascalCase(str);\n\n override createWebpackConfig: RendererWebpackBase['createWebpackConfig'] =\n () => {\n const config = super.createWebpackConfig();\n\n config.externals = {\n react: 'React',\n 'react-dom': 'ReactDOM',\n };\n\n return config;\n };\n\n override getJsImports: RendererWebpackBase['getJsImports'] = () => {\n const imports = super.getJsImports();\n imports.push(\n {\n type: 'extra',\n importInfo: {\n type: 'default',\n path: this.demoWrapperPath,\n name: 'DemoWrapper',\n },\n },\n {\n type: 'extra',\n importInfo: {\n type: 'default',\n path: join(__dirname, './error-catcher.mjs'),\n name: 'ErrorCatcher',\n },\n },\n );\n return imports;\n };\n\n async prepClientRenderResults({\n usage,\n demoApp,\n imports: xImports,\n renderOptions: { pattern, template, demo },\n }: {\n usage: string;\n demoApp: string;\n imports: KsJsImport[];\n renderOptions: KnapsackRenderParams;\n }): ReturnType<Renderer['render']> {\n const extraImports = this.getJsImports().filter(\n (imp) => imp.type === 'extra',\n );\n const { imports, isDeclaredVarsUnique, nameCollisions } =\n this.makeKsJsImportsUnique({ imports: [...xImports, ...extraImports] });\n\n if (!isDeclaredVarsUnique) {\n log.error(`${nameCollisions.join(', ')} are declared multiple times`, {\n imports,\n });\n }\n const meta: KsReactMeta = {\n demo,\n disableReactStrictMode: this.disableReactStrictMode,\n neededImports: imports,\n demoWrapperProps: {\n pattern,\n template,\n demo,\n patternsUsed: imports.flatMap((imp) => {\n if (imp.type === 'pattern-template') {\n return [\n {\n patternId: imp.patternId,\n templateId: imp.templateId,\n },\n ];\n }\n if (imp.type === 'pattern-template-demo') {\n return [\n {\n patternId: imp.patternId,\n templateId: imp.templateId,\n demoId: imp.demoId,\n },\n ];\n }\n return [];\n }),\n },\n };\n\n let code = `\n window.knapsack = window.knapsack || {};\n window.knapsack.getDemoApp = ({ ${imports\n .map((i) => i.importInfo.name)\n .join(', ')} }) => {\n ${demoApp}\n return ${demoAppName}\n }\n `;\n\n let errorHtmlMsg = '';\n try {\n code = await babelCodeForBrowser({ code });\n } catch (e) {\n console.log(code);\n console.log('---original code before babel error ^---');\n console.trace(e.message);\n code = `console.error(${JSON.stringify(e.message)});`;\n errorHtmlMsg = `<pre><code>${e.message}</code></pre>`;\n }\n\n const html = `\n <script type=\"application/json\" id=\"${rendererMetaScriptTagId}\">${JSON.stringify(\n meta,\n )}</script>\n <script type=\"application/javascript\">${code}</script>\n <div id=\"render-root\" class=\"knapsack-pattern-direct-parent\" data-dev-note=\"Knapsack React Template Wrapper\"></div>\n ${this.assets.map((asset) => `<script src=\"${asset}\"></script>`).join('\\n')}\n ${this.createHtmlTagsForAssetPaths({\n assets: this.getWebpackAssetPaths(),\n // we need the scripts to finish adding methods to the global knapsack object synchronously before the client-side code runs that is in the <script> tag below\n scriptTagsAreAsync: false,\n })}\n ${errorHtmlMsg}\n `;\n\n return {\n ok: !errorHtmlMsg,\n html: await formatCode({\n contents: html,\n path: 'x.html', // doing this to set format language\n }),\n usage,\n templateLanguage: this.language,\n };\n }\n\n render: Renderer['render'] = async (opt) => {\n if (opt.demo?.type === 'template') {\n // when getting a template demos path sometimes we have a race condition where the client asks for it before the server knows about it.\n // so we try several times in a row to get it\n /** The amount of time in ms to wait between attempts; when we run out of array items, we give up and throw the error */\n const waits = [5, 10, 20, 50, 100, 1000, 1000];\n let templateDemoPath: string;\n let attempt = 0;\n\n while (true) {\n try {\n const { absolutePath, exists } = await this.resolvePath(\n opt.demo.templateInfo.path,\n );\n if (!exists) {\n throw new Error(\n `Template demo file does not exist: ${absolutePath}`,\n );\n }\n templateDemoPath = absolutePath;\n // got it!\n break;\n } catch (e) {\n const waitTime = waits[attempt];\n if (!waitTime) {\n throw new Error(e);\n }\n attempt += 1;\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTime);\n }\n }\n\n const [templateFileContents, { usage, imports }] = await Promise.all([\n readFile(templateDemoPath),\n this.getUsageAndImports(opt),\n ]);\n const demoApp = await getDemoAppUsage({\n children: usage,\n });\n const results = await this.prepClientRenderResults({\n usage: templateFileContents,\n demoApp,\n imports,\n renderOptions: opt,\n });\n\n return results;\n }\n\n if (opt.demo?.type === 'data') {\n const { usage, imports } = await this.getUsageAndImports(opt);\n const { code: importCode } = this.createJsImportCodeBlock({\n imports,\n });\n\n const [demoAppUsage, demoApp] = await Promise.all([\n getDemoAppUsage({\n children: usage,\n imports: importCode,\n format: true,\n }),\n getDemoAppUsage({\n children: usage,\n }),\n ]);\n\n return this.prepClientRenderResults({\n demoApp,\n usage: demoAppUsage,\n imports,\n renderOptions: opt,\n });\n }\n };\n\n getUsageAndImports: RendererWebpackBase['getUsageAndImports'] = async ({\n pattern,\n template,\n patternManifest,\n demo,\n }) => {\n if (demo?.type && demo.type === 'data') {\n const {\n data: { props, slots, slotsOptionsComputed },\n } = demo;\n\n const importInfo = this.getJsImport({\n patternId: pattern.id,\n templateId: template.id,\n });\n if (!importInfo) {\n throw new Error(\n `Could not find import for pattern-template: ${pattern.id}-${template.id}`,\n );\n }\n const { type, name: templateName } = importInfo.importInfo;\n\n const importInfos: KsJsImport[] = [importInfo];\n const children: string[] = [];\n const extraProps: { key: string; value: string }[] = [];\n\n if (slots) {\n const slotNames = Object.keys(slots);\n const slotUsages = await Promise.all(\n slotNames.map(async (slotName) => {\n const slotItems = slots[slotName];\n const slotItemsUsages = await Promise.all(\n slotItems\n // remove any incomplete item - happens when users are filling out form\n .filter((slotItem) => {\n if (slotItem.type !== 'text') {\n if (!slotItem.patternId) return false;\n if (!slotItem.templateId) return false;\n if (slotItem.type === 'template-demo' && !slotItem.demoId) {\n return false;\n }\n }\n return true;\n })\n .map(async (slotItem) => {\n if (slotItem.type === 'text') {\n if (slotItems.length === 1 && slotName !== 'children') {\n // The ` prevents multi-line strings from causing error (even though they don't show a line break)\n return `\\`${slotItem.text}\\``;\n }\n return slotItem.text;\n }\n\n const slotPattern = patternManifest.getPattern(\n slotItem.patternId,\n );\n\n const slotTemplate = slotPattern.templates.find(\n (t) => t.id === slotItem.templateId,\n );\n if (slotItem.type === 'template-reference') {\n const { usage, imports } = await this.getUsageAndImports({\n pattern: slotPattern,\n template: slotTemplate,\n patternManifest,\n });\n importInfos.push(...imports);\n return usage;\n }\n if (slotItem.type === 'template-demo') {\n const { usage, imports } = await this.getUsageAndImports({\n pattern: slotPattern,\n template: slotTemplate,\n demo:\n slotItem.demo ||\n this.patterns.demosById[slotItem.demoId],\n patternManifest,\n });\n importInfos.push(...imports);\n return usage;\n }\n\n throw new Error(\n `Unknown slot item: ${JSON.stringify(slotItem)}`,\n );\n }),\n );\n return {\n slotName,\n slotItemsUsages,\n };\n }),\n );\n\n slotUsages.forEach(({ slotName, slotItemsUsages }) => {\n const slotOptionsComputed = slotsOptionsComputed?.[slotName];\n const { openTag, closeTag } = createSlotOptionsHtmlTags({\n slotOptionsComputed,\n classAttributeName: 'className',\n stylesValueType: 'object',\n });\n if (openTag) {\n if (slotName === 'children') {\n children.push(openTag);\n } else {\n extraProps.push({\n key: slotName,\n value: openTag,\n });\n }\n }\n\n slotItemsUsages.forEach((usage) => {\n if (slotName === 'children') {\n children.push(usage);\n } else {\n extraProps.push({\n key: slotName,\n value: usage,\n });\n }\n });\n\n if (closeTag) {\n if (slotName === 'children') {\n children.push(closeTag);\n } else {\n extraProps.push({\n key: slotName,\n value: closeTag,\n });\n }\n }\n });\n }\n\n const usage = await getUsage({\n templateName,\n props,\n children: children.join('\\n'),\n extraProps,\n });\n\n return {\n usage,\n imports: importInfos,\n };\n }\n\n if (demo?.type && demo.type === 'template') {\n const importInfo = this.getJsImport({\n patternId: pattern.id,\n templateId: template.id,\n demoId: demo.id,\n });\n if (!importInfo) {\n throw new Error(\n `Could not find import for pattern-template-demo: ${pattern.id}-${template.id}-${demo.id}`,\n );\n }\n const { type, name: templateName } = importInfo.importInfo;\n\n const usage = await getUsage({ templateName });\n\n return {\n usage,\n imports: [importInfo],\n };\n }\n\n if (!demo) {\n const importInfo = this.getJsImport({\n patternId: pattern.id,\n templateId: template.id,\n });\n if (!importInfo) {\n throw new Error(\n `Could not find import for pattern-template: ${pattern.id}-${template.id}`,\n );\n }\n const { type, name: templateName } = importInfo.importInfo;\n\n return {\n /**\n * i.e. Given a React Component, `Button`, normally this would be `<Button>` with a demo, but since there is none this will just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n * @see {SlottedTemplate}\n */\n usage: templateName,\n imports: [importInfo],\n };\n }\n\n throw new Error(\n `Unhandled demo type for ${pattern.id}-${template.id}: ${JSON.stringify(\n demo,\n )}`,\n );\n };\n\n inferSpec: Renderer['inferSpec'] = async ({\n template,\n templatePath,\n }: {\n template: KnapsackPatternTemplate;\n templatePath: string;\n }): Promise<KsTemplateSpec | false> => {\n const spec = await getReactDocs({\n src: template.path,\n exportName: template.alias || 'default',\n resolveFromDir: this.config.data,\n });\n if (spec !== false) {\n const totalProps = Object.keys(spec?.props?.properties || {}).length;\n const totalSlots = Object.keys(spec?.slots || {}).length;\n if (totalProps === 0 && totalSlots === 0) {\n return false;\n }\n }\n return spec;\n };\n\n override watch: Renderer['watch'] = async (opt) => {\n super.watch(opt);\n knapsackEvents.onPatternTemplateChanged(() => {\n clearInferSpecCache();\n });\n };\n\n getTemplateMeta: Renderer['getTemplateMeta'] = async ({\n pattern,\n template,\n }) => {\n const files: KnapsackFile[] = [];\n if (template?.spec?.props) {\n const schema = JSON.parse(JSON.stringify(template.spec.props));\n if (template?.spec?.slots) {\n Object.entries(template.spec.slots).forEach(([id, info]) => {\n schema.properties[id] = {\n typeof: 'function',\n tsType: 'React.ReactNode',\n\n description: info.allowedPatternIds\n ? `${info.description}. Only use: ${info.allowedPatternIds.join(\n ', ',\n )}`\n : info.description,\n };\n schema.required = schema.required ?? [];\n if (info.isRequired) schema.required.push(id);\n });\n }\n const typeDefs =\n await KnapsackReactRenderer.convertSchemaToTypeScriptDefs({\n schema,\n title: `${this.changeCase(pattern.id)}Props`,\n // @todo pull in base url\n description: `[Knapsack Docs](http://localhost:3999/pattern/${pattern.id}/${template.id})`,\n patternId: pattern.id,\n templateId: template.id,\n postBanner: `import * as React from 'react';`,\n });\n\n files.push({\n contents: typeDefs,\n encoding: 'utf8',\n path: `${pattern.id}.${template.id}.spec.d.ts`,\n });\n files.push({\n contents: JSON.stringify(schema, null, ' '),\n encoding: 'utf8',\n path: `${pattern.id}.${template.id}.spec.json`,\n });\n }\n return files;\n };\n\n alterTemplateMetaFiles: Renderer['alterTemplateMetaFiles'] = async ({\n files,\n metaDir,\n }) => {\n const imports: string[] = [];\n\n const ext = '.spec.d.ts';\n files.forEach((file) => {\n if (file.path.endsWith(ext)) {\n const { base } = parse(file.path);\n const [patternId, templateId] = base.split('.');\n const isFirst = templateId === this.id;\n const exportName = this.changeCase(`${patternId}Props`);\n const exportNameWithTemplateId = this.changeCase(\n `${patternId}-${templateId}Props`,\n );\n imports.push(\n `export { ${\n isFirst\n ? exportName\n : `${exportName} as ${exportNameWithTemplateId}`\n } } from './${relative(metaDir, file.path).replace('.d.ts', '')}';`,\n );\n }\n });\n\n // extra line at end of file\n imports.push('');\n\n return [\n ...files,\n {\n contents: imports.join('\\n'),\n encoding: 'utf8',\n path: join(metaDir, 'react.d.ts'),\n },\n ];\n };\n\n getTemplateSuggestions: Renderer['getTemplateSuggestions'] = async ({\n newPath,\n }) => {\n const { data: dataDir } = this.patterns.userConfig;\n const { allTemplateDemos, allTemplates } = this.getMyTemplates();\n const usedSuggestions: TemplateSuggestion[] = [\n ...allTemplateDemos,\n ...allTemplates,\n ].map(({ path, alias }) => {\n return {\n path,\n alias: alias || 'default',\n };\n });\n\n const allPaths = [\n ...new Set([newPath, ...usedSuggestions.map(({ path }) => path)]),\n ];\n const allSuggestions: TemplateSuggestion[] = await Promise.all(\n allPaths.map(async (path): Promise<TemplateSuggestion[]> => {\n if (!path) return [];\n try {\n const { exports, errorMsg } = await getJsExportNames({\n path,\n resolveFromDir: dataDir,\n pkgPathAliases: this.pkgPathAliases,\n });\n if (errorMsg) {\n throw new Error(errorMsg);\n }\n return (\n exports\n // only allow names that start with a capital letter (i.e. React Component names)\n // will exclude helper functions and custom hooks\n .filter((e) => e === 'default' || isFirstLetterCapital(e))\n .map((name) => ({\n alias: name,\n path,\n }))\n );\n } catch (e) {\n // only want this showing with verbose since template suggestions are not critical\n log.verbose(\n `Error getting import names for ${path}: ${e.message}`,\n null,\n this.logPrefix,\n );\n return [];\n }\n }),\n ).then((results) => {\n // sadly `Promise.all` & `.flatMap` just don't work, so this:\n return results.flat();\n });\n\n const suggestions = allSuggestions.filter((s) => {\n return !usedSuggestions.find(\n (us) => us.alias === s.alias && us.path === s.path,\n );\n });\n\n return {\n suggestions,\n };\n };\n}\n","import { log } from '@knapsack/app';\nimport {\n getModulePkgJson,\n readFile,\n copy,\n formatCode,\n resolvePath,\n findUp,\n} from '@knapsack/file-utils';\nimport { removeWrappingDoubleQuotes } from '@knapsack/utils';\nimport path from 'path';\nimport type { Documentation } from 'react-docgen';\nimport type { ComponentDoc, ParserOptions } from 'react-docgen-typescript';\nimport { KsTemplateSpec, isNumberProp, isOptionsProp } from '@knapsack/types';\n\ntype GetSpecParams = {\n src: string;\n exportName?: string;\n};\n\n/**\n * The name of the type, which is usually corresponds to the function name in `React.PropTypes`. However, for types define with `oneOf`, we use `\"enum\"` and for `oneOfType` we use `\"union\"`. If a custom function is provided or the type cannot be resolved to anything of `React.PropTypes`, we use `\"custom\"`.\n */\ntype RdTypeName =\n | 'number'\n | 'string'\n | 'custom'\n | 'union'\n | 'bool'\n | 'node'\n | 'func';\n\n/**\n * Some types accept parameters which define the type in more detail (such as `arrayOf`, `instanceOf`, `oneOf`, etc). Those are stored in `<typeValue>`. The data type of `<typeValue>` depends on the type definition.\n */\ntype RdTypeValue = string;\n\ntype RdProps = {\n [prop: string]: {\n defaultValue?: {\n value: string;\n computed: boolean;\n };\n type: {\n name: RdTypeName;\n value?: RdTypeValue;\n raw?: string;\n };\n flowType?: string;\n tsType?: string;\n description?: string;\n required: boolean;\n };\n};\n\ntype RdResults = {\n /**\n * Name of function, class, or const\n */\n displayName: string;\n description?: string;\n props: RdProps;\n};\n\nfunction renderUsageTemplate({\n templateName,\n attributes,\n children,\n}: {\n templateName: string;\n attributes: string;\n children: string;\n}) {\n return `\n <${templateName}\n ${attributes}\n ${\n children\n ? `>\n ${children}\n </${templateName}>`\n : '/>'\n }\n `;\n}\nexport const demoAppName = 'DemoApp';\n\nfunction renderDemoAppTemplate({\n imports = '',\n children,\n}: {\n imports: string;\n children: string;\n}) {\n return `${imports}\n\nfunction ${demoAppName}() {\n return (\n ${children}\n )\n}\n`;\n}\n\nexport async function getUsage(data: {\n templateName: string;\n props?: Record<string, unknown>;\n children?: string;\n extraProps?: {\n key: string;\n value: string;\n }[];\n format?: boolean;\n}): Promise<string> {\n const props = Object.keys(data.props || {}).map((key) => {\n const value = data.props[key];\n return {\n key,\n value,\n };\n });\n\n const { templateName, children, extraProps = [] } = data;\n if (!templateName) {\n throw new Error(\n `Cannot getUsage of a React Component when no \"templateName\" is provided.`,\n );\n }\n\n const attributes: string[] = props.map(({ key, value }) => {\n switch (typeof value) {\n case 'string':\n // Is this a function like `() => {}` but not a \"sizes\" attribute for an image like `(min-width: 400px) 50vw, 100vw`?\n if (value.startsWith('(') && value.includes('=>')) {\n return `${key}={${value}}`;\n }\n return `${key}=\"${value}\"`;\n case 'boolean':\n return value ? `${key}` : `${key}={${value}}`;\n default:\n return `${key}={${JSON.stringify(value)}}`;\n }\n });\n\n const extraAttributes: string[] = [];\n const slotProps: { [key: string]: string[] } = {};\n\n extraProps.forEach(({ key, value }) => {\n slotProps[key] = slotProps[key] ?? [];\n slotProps[key].push(value);\n });\n\n Object.entries(slotProps).forEach(([key, values]) => {\n const value = values.length === 1 ? values[0] : `<>${values.join('\\n')}</>`;\n extraAttributes.push(`${key}={${value}}`);\n });\n\n const result = renderUsageTemplate({\n templateName,\n attributes: [...attributes, ...extraAttributes].join(' '),\n children,\n });\n return data.format\n ? formatCode({\n contents: result,\n path: 'x.tsx', // doing this to set format language\n })\n .then((code) => code.trim())\n .catch(() => result.trim()) // if format fails, just return the unformatted code\n : result.trim();\n}\n\nexport async function getDemoAppUsage({\n children,\n imports,\n format,\n}: {\n children: string;\n imports?: string;\n format?: boolean;\n}): Promise<string> {\n const code = renderDemoAppTemplate({\n children,\n imports,\n });\n if (!format) return code;\n return formatCode({\n contents: code,\n path: 'x.tsx', // doing this to set format language\n });\n}\n\nasync function getTypeScriptInfoFromFile({ src }: { src: string }): Promise<{\n info: ComponentDoc[];\n}> {\n const tsConfigPath = await findUp('tsconfig.json', {\n cwd: path.dirname(src),\n });\n const rdTs = await import('react-docgen-typescript');\n const config: ParserOptions = {\n shouldExtractLiteralValuesFromEnum: true,\n savePropValueAsString: true,\n skipChildrenPropWithoutDoc: false,\n // In addition to the ones listed here, which had not strangely included these below ~ https://github.com/styleguidist/react-docgen-typescript/blob/287e7012843cb26fed8f4bd8ee24e462c25a1414/src/parser.ts#L308\n customComponentTypes: ['VoidFunctionComponent', 'VFC'],\n };\n const parse = tsConfigPath\n ? rdTs.withCustomConfig(tsConfigPath, config).parse\n : rdTs.withDefaultConfig(config).parse;\n return {\n info: parse(src),\n };\n}\n\nfunction extractSpecFromTypeScriptInfo({\n info: results,\n exportName,\n}: {\n info: ComponentDoc[];\n exportName: string;\n}): KsTemplateSpec | false {\n try {\n if (!results) return false;\n const spec: KsTemplateSpec = {\n props: {\n $schema: 'http://json-schema.org/draft-07/schema',\n type: 'object',\n required: [],\n properties: {},\n },\n slots: {\n // children: {\n // title: 'children',\n // },\n },\n };\n\n const isDefaultExport = !exportName || exportName === 'default';\n\n // if `isDefaultExport` then we just grab last result since `export default` TENDS to be last. that'll we can do really...\n const result = isDefaultExport\n ? results.pop()\n : results.find((r) => r.displayName === exportName);\n\n // log.inspect({ result, isDefaultExport, exportName }, 'ts result');\n if (!result) return false;\n\n const { displayName } = result;\n // log.inspect({ result }, 'result');\n Object.entries(result?.props || {}).forEach(([propName, propDef]) => {\n const { name, description, defaultValue, required, type, parent } =\n propDef;\n\n // `type.name` can include `| undefined` if tsConfig has `strict: true`. So we need to handle these scenarios:\n // `string` or `string | undefined`\n // `'left' | 'right'` or `'left' | 'right' | undefined`\n const propType = type?.name\n ?.replace('| undefined', '')\n // remove generics. things like `FC<{}>` and `FC<Props>` should become `FC`\n .replace(/<.*/g, '')\n .trim();\n\n switch (propType) {\n case 'string':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'number':\n spec.props.properties[propName] = {\n type: 'number',\n };\n break;\n case 'boolean':\n case 'bool':\n if (defaultValue && 'value' in defaultValue) {\n // comes in as `'true'` - this turns it to `true`\n defaultValue.value = defaultValue.value === 'true';\n }\n spec.props.properties[propName] = {\n type: 'boolean',\n };\n break;\n case 'enum':\n type EnumType = {\n name: string;\n raw: string;\n value: {\n /** Looks like `'\"option1\"'` - beware of string that contains `\"` */\n value: string;\n }[];\n };\n spec.props.properties[propName] = {\n type: 'string',\n // yes there is a double \"value\" & yes it is confusing\n enum: [\n // ensure list is unique\n ...new Set<string>(\n (type as EnumType).value\n .map(({ value }) => removeWrappingDoubleQuotes(value?.trim()))\n .filter(Boolean),\n ),\n ],\n };\n break;\n case 'ReactNode':\n case 'React.ReactNode':\n case 'React.ReactElement':\n case 'ReactElement':\n spec.slots[propName] = {\n title: propName,\n };\n if (description) {\n spec.slots[propName] = {\n ...spec.slots[propName],\n description,\n };\n }\n break;\n case 'VFC':\n case 'FC':\n spec.slots[propName] = {\n title: propName,\n description: description || 'A reference to a component',\n isTemplateReference: true,\n allowOnlyOne: true,\n disallowText: true,\n };\n break;\n default: {\n if (type?.name?.startsWith('(')) {\n // functions\n spec.props.properties[propName] = {\n // description: `\\`${type.name}\\` ${description}`,\n typeof: 'function',\n tsType: propDef?.type?.name,\n };\n } else if (type?.name?.includes('|')) {\n // enums / unions (multi-choice strings)\n // comes in like this: `{ name: '\"option1\" | \"option2\" | \"option3\"' }`\n const options = type.name\n .split('|')\n .map((enumItem) => removeWrappingDoubleQuotes(enumItem.trim()))\n .filter(Boolean);\n\n if (options?.length) {\n spec.props.properties[propName] = {\n type: 'string',\n // ensuring list is unique\n enum: [...new Set(options)],\n };\n }\n } else {\n spec.props.properties[propName] = {\n tsType: propDef?.type?.name,\n };\n }\n }\n }\n\n // assigning info that all would have\n if (spec.props.properties[propName]) {\n if (required) spec.props.required.push(propName);\n if (description && !spec.props.properties[propName].description) {\n spec.props.properties[propName].description = description;\n }\n if (defaultValue && 'value' in defaultValue) {\n if (isNumberProp(spec.props.properties[propName])) {\n spec.props.properties[propName].default = parseFloat(\n defaultValue.value,\n );\n } else {\n spec.props.properties[propName].default =\n removeWrappingDoubleQuotes(defaultValue.value);\n }\n }\n }\n\n // console.log('type', type);\n });\n\n return spec;\n } catch (error) {\n log.verbose(\n 'Could not infer spec from React TypeScript file',\n {\n exportName,\n error,\n },\n 'react renderer',\n );\n return false;\n }\n}\n\nasync function getPropTypesInfoFromFile({ src }: { src: string }): Promise<{\n info: Documentation[];\n}> {\n const reactDocs = await import('react-docgen');\n const { builtinResolvers } = reactDocs;\n const fileSrc = await readFile(src);\n const { FindExportedDefinitionsResolver } = builtinResolvers;\n const results: Documentation[] = reactDocs.parse(fileSrc, {\n resolver: new FindExportedDefinitionsResolver(),\n handlers: null,\n filename: src,\n // babelrc: false,\n });\n return {\n info: results,\n };\n}\n\nfunction extractSpecFromPropTypesInfo({\n info: results,\n exportName,\n}: {\n info: Documentation[];\n exportName: string;\n}): KsTemplateSpec | false {\n try {\n const isDefaultExport = !exportName || exportName === 'default';\n\n // if `isDefaultExport` then we just grab last result since `export default` TENDS to be last. that'll we can do really...\n const result = isDefaultExport\n ? results.pop()\n : results.find((r) => r.displayName === exportName);\n\n // log.inspect(results, 'JSX PropTypes Results');\n // console.log(JSON.stringify(result, null, ' '));\n\n const spec: KsTemplateSpec = {\n isInferred: true,\n props: {\n $schema: 'http://json-schema.org/draft-07/schema',\n type: 'object',\n required: [],\n properties: {},\n },\n slots: {},\n };\n\n Object.entries(result?.props || {}).forEach(([propName, propDef]) => {\n const { required, description, defaultValue } = propDef;\n switch (propDef?.type?.name) {\n case 'string':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'func':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'bool':\n spec.props.properties[propName] = {\n type: 'boolean',\n };\n break;\n case 'node':\n spec.slots[propName] = {\n title: propName,\n description,\n };\n }\n\n // assigning info that all would have\n if (spec.props.properties[propName]) {\n if (required) spec.props.required.push(propName);\n if (description && !spec.props.properties[propName].description) {\n spec.props.properties[propName].description = description;\n }\n if (defaultValue && 'value' in defaultValue) {\n spec.props.properties[propName].default =\n typeof defaultValue.value === 'string'\n ? removeWrappingDoubleQuotes(defaultValue.value)\n : defaultValue.value;\n }\n }\n });\n\n return spec;\n } catch (error) {\n log.verbose(\n 'Could not infer spec from React PropTypes',\n {\n exportName,\n error,\n },\n 'react renderer',\n );\n return false;\n }\n}\n\nfunction cleanUpSpec({\n spec,\n}: {\n spec: KsTemplateSpec | false;\n}): KsTemplateSpec | false {\n if (spec === false) return spec;\n // ok to mutate b/c spec was just created before passing in here\n Object.entries(spec?.props?.properties || {}).forEach(([propName, prop]) => {\n if (isOptionsProp(prop)) {\n // If the default is not in the enum, it should not be there\n // OR the enum is wrong\n if (!prop.enum.includes(prop.default)) {\n prop.default = undefined;\n }\n }\n });\n\n return spec;\n}\n\nasync function getReactModuleInfoUncached({\n src: unknownSrc,\n resolveFromDir,\n}: {\n src: string;\n resolveFromDir: string;\n}): Promise<\n | {\n type: 'typescript';\n info: ComponentDoc[];\n }\n | {\n type: 'propTypes';\n info: Documentation[];\n }\n | {\n type: 'unknown';\n }\n> {\n const typesInfo = await resolvePath({\n path: unknownSrc,\n resolveFromDir,\n resolveType: 'types',\n });\n if (typesInfo.exists) {\n const typeScriptInfo = await getTypeScriptInfoFromFile({\n src: typesInfo.absolutePath,\n });\n if (typeScriptInfo) {\n return {\n type: 'typescript',\n info: typeScriptInfo.info,\n };\n }\n }\n const jsInfo = await resolvePath({\n path: unknownSrc,\n resolveFromDir,\n });\n if (!jsInfo.exists) return { type: 'unknown' };\n const { ext } = path.parse(jsInfo.absolutePath);\n switch (ext) {\n case '.jsx': {\n const propTypesInfo = await getPropTypesInfoFromFile({\n src: jsInfo.absolutePath,\n });\n return {\n type: 'propTypes',\n info: propTypesInfo.info,\n };\n }\n case '.ts':\n case '.tsx': {\n const typeScriptInfo = await getTypeScriptInfoFromFile({\n src: jsInfo.absolutePath,\n });\n return {\n type: 'typescript',\n info: typeScriptInfo.info,\n };\n }\n default:\n return {\n type: 'unknown',\n };\n }\n}\n\nconst getReactModuleInfoCache = new Map<\n string,\n ReturnType<typeof getReactModuleInfoUncached>\n>();\nexport const clearInferSpecCache = () => {\n log.info(`Clearing React TypeScript inferSpec cache...`);\n getReactModuleInfoCache.clear();\n};\nasync function getReactModuleInfo(\n args: Parameters<typeof getReactModuleInfoUncached>[0],\n) {\n const cacheKey = JSON.stringify(args);\n if (!getReactModuleInfoCache.has(cacheKey)) {\n getReactModuleInfoCache.set(cacheKey, getReactModuleInfoUncached(args));\n }\n return getReactModuleInfoCache.get(cacheKey);\n}\n\nasync function getReactSpec({\n src,\n exportName,\n resolveFromDir,\n}: GetSpecParams & {\n resolveFromDir: string;\n}): Promise<KsTemplateSpec | false> {\n const reactModuleInfo = await getReactModuleInfo({\n src,\n resolveFromDir,\n });\n switch (reactModuleInfo.type) {\n case 'typescript':\n return extractSpecFromTypeScriptInfo({\n info: reactModuleInfo.info,\n exportName,\n });\n case 'propTypes':\n return extractSpecFromPropTypesInfo({\n info: reactModuleInfo.info,\n exportName,\n });\n case 'unknown':\n default:\n return false;\n }\n}\n\nexport async function getReactDocs(\n opt: GetSpecParams & {\n resolveFromDir: string;\n },\n): Promise<KsTemplateSpec | false> {\n return cleanUpSpec({\n spec: await getReactSpec(opt),\n });\n}\n\nexport async function copyReactAssets(\n distDirAbsolute: string,\n publicPath: string,\n): Promise<string[]> {\n try {\n const { version: reactVersion } = getModulePkgJson('react');\n const { version: reactDomVersion } = getModulePkgJson('react-dom');\n\n // switch to resolving the root NPM package dir vs the entire file via require.resolve\n // workaround due to NPM packages using the exports field; prevents these from being auto-resolved\n const reactRoot = path.dirname(\n require.resolve('react', {\n paths: [process.cwd()],\n }),\n );\n const reactDomRoot = path.dirname(\n require.resolve('react-dom', {\n paths: [process.cwd()],\n }),\n );\n await Promise.all([\n copy(\n path.join(reactRoot, 'umd/react.development.js'),\n path.join(distDirAbsolute, `react.development.${reactVersion}.js`),\n ),\n copy(\n path.join(reactRoot, 'umd/react.production.min.js'),\n path.join(distDirAbsolute, `react.production.min.${reactVersion}.js`),\n ),\n copy(\n path.join(reactDomRoot, 'umd/react-dom.production.min.js'),\n path.join(\n distDirAbsolute,\n `react-dom.production.min.${reactDomVersion}.js`,\n ),\n ),\n copy(\n path.join(reactDomRoot, 'umd/react-dom.development.js'),\n path.join(\n distDirAbsolute,\n `react-dom.development.${reactDomVersion}.js`,\n ),\n ),\n ]);\n const reactFileSuffix =\n process.env.NODE_ENV === 'production' ? 'production.min' : 'development';\n\n return [\n path.join(publicPath, `react.${reactFileSuffix}.${reactVersion}.js`),\n path.join(\n publicPath,\n `react-dom.${reactFileSuffix}.${reactDomVersion}.js`,\n ),\n ];\n } catch (error) {\n log.warn(\n 'Error trying to copy \"react\" and \"react-dom\" JS files, are they installed? We want to use your exact versions.',\n error,\n 'templateRenderer:react',\n );\n process.exit(1);\n }\n}\n","import { getJsExportNames } from '@knapsack/file-utils';\nimport { createCreator, tasks, Task } from '@knapsack/creator-utils';\nimport {\n readKsPatternConfigs,\n writeKsPatternConfig,\n readKsNavConfig,\n addKsNavItems,\n writeDemo,\n} from '@knapsack/ks-file-utils';\nimport { Demo, KnapsackPattern } from '@knapsack/types';\nimport { makeShortId } from '@knapsack/utils';\n\nfunction isCapitalLetter(char: string): boolean {\n return char.toUpperCase() === char;\n}\n\nfunction startsWithCapitalLetter(str: string): boolean {\n return isCapitalLetter(str[0]);\n}\n\nfunction createPatternData({\n importName,\n id,\n title = importName,\n pkgPath,\n initialDemoId,\n}: {\n importName: string;\n id: string;\n title?: string;\n pkgPath: string;\n initialDemoId: string;\n}): KnapsackPattern {\n return {\n id,\n title,\n description: '',\n statuses: {\n main: 'ready',\n },\n templates: [\n {\n id: 'react',\n title: 'react',\n path: pkgPath,\n alias: importName,\n templateLanguageId: 'react',\n spec: {\n isInferred: true,\n },\n demoIds: [initialDemoId],\n blockIds: [],\n },\n ],\n tabs: [\n {\n type: 'template',\n id: 'react',\n },\n ],\n subPages: [],\n };\n}\n\nexport const createReactPattern = createCreator({\n id: 'react-patterns',\n title: 'React Ks Patterns',\n description: 'Adds React templates as Knapsack Patterns',\n getQuestions: async () => ({\n pkgPath: {\n type: 'text',\n title: 'Package path',\n },\n importPrefix: {\n type: 'text',\n title: 'Import Prefix to Remove',\n },\n }),\n getTasks: async ({ answers: { pkgPath, importPrefix = '' }, config }) => {\n const dataDir = config.dest;\n const currentPatterns = await readKsPatternConfigs({\n dataDir,\n });\n const currentReactPatternsImportNames = currentPatterns.reduce(\n (cur, pattern) => {\n const reactTemplates =\n pattern.templates?.filter((t) => t.templateLanguageId === 'react') ??\n [];\n cur.push(...reactTemplates.map((t) => t.alias));\n return cur;\n },\n [] as string[],\n );\n const { exports: allImports } = await getJsExportNames({\n path: pkgPath,\n });\n return [\n {\n title: 'Pick Imports to add',\n task: (_, task) =>\n tasks.runSubCreator({\n task,\n config,\n creator: createCreator({\n id: 'react-pattern-import-names',\n getQuestions: async () => ({\n importNames: {\n type: 'choices',\n choices: allImports\n .filter(\n (importName) =>\n startsWithCapitalLetter(importName) &&\n !currentReactPatternsImportNames.includes(importName),\n )\n .map((importName) => ({\n value: importName,\n })),\n },\n }),\n getTasks: async ({ answers: { importNames } }) => {\n const patterns = importNames.map((importName) => ({\n importName,\n patternId: importName.startsWith(importPrefix)\n ? importName.slice(importPrefix.length).toLowerCase()\n : importName.toLowerCase(),\n }));\n return [\n ...patterns.map(\n ({ importName, patternId }): Task => ({\n title: `Add ${importName} React Template`,\n task: async (__, subTask) => {\n const initialDemo: Demo = {\n type: 'data',\n id: makeShortId(),\n title: 'Main',\n patternId,\n templateId: 'react',\n data: {\n props: {},\n slots: {},\n },\n };\n const pattern = createPatternData({\n id: patternId,\n importName,\n pkgPath,\n initialDemoId: initialDemo.id,\n });\n\n await Promise.all([\n writeDemo({\n dataDir,\n demo: initialDemo,\n }),\n writeKsPatternConfig({\n dataDir,\n patternId,\n data: pattern,\n }),\n ]);\n },\n }),\n ),\n {\n title: `Updating Nav`,\n task: async (__, subTask) => {\n const { byId } = await readKsNavConfig({\n dataDir,\n });\n // attempt to find a nav group to put patterns under\n const componentsGroup = Object.values(byId).find(\n ({ path, name, id }) => {\n // we only want groups (i.e. not pages or patterns)\n if (path) return false;\n if (name.toLowerCase() === 'patterns') return true;\n if (name.toLowerCase() === 'components') return true;\n return false;\n },\n );\n await addKsNavItems({\n dataDir,\n navItems: patterns.map(({ patternId }) => ({\n navId: patternId,\n navPath: `/pattern/${patternId}`,\n navParent: componentsGroup?.id || 'root',\n })),\n });\n },\n },\n ];\n },\n }),\n }),\n },\n ];\n },\n});\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n"]}
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/renderer-react.ts","../src/utils.ts","../src/react-creators.ts","../src/types.ts"],"sourcesContent":["export * from './renderer-react';\nexport type { DemoWrapperProps } from './types';\n","import sleep from 'sleep-promise';\nimport {\n RendererWebpackBase,\n Renderer,\n KsJsImportMap,\n convertImportMapToNeededImportsByPath,\n} from '@knapsack/renderer-webpack-base';\nimport { pascalCase, isFirstLetterCapital } from '@knapsack/utils';\nimport { knapsackEvents, log } from '@knapsack/app';\nimport {\n Renderable,\n babelCodeForBrowser,\n createSlotOptionsHtmlTags,\n} from '@knapsack/app/renderers';\nimport {\n KnapsackFile,\n KnapsackPatternTemplate,\n KsTemplateSpec,\n TemplateSuggestion,\n rendererIds,\n RendererId,\n} from '@knapsack/types';\nimport {\n exists as fileExists,\n findUpPkgJson,\n getJsExportNames,\n readFile,\n formatCode,\n assertFileExists,\n} from '@knapsack/file-utils';\nimport { join, relative, parse, isAbsolute } from 'path';\nimport {\n clearInferSpecCache,\n copyReactAssets,\n demoAppName,\n getDemoAppUsage,\n getReactDocs,\n getUsage,\n} from './utils';\nimport { createReactPattern } from './react-creators';\nimport { KsReactMeta, rendererMetaScriptTagId } from './types';\n\nconst { pkg } = findUpPkgJson(__dirname);\n// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\nlog.setupUpdateNotifier({ ...pkg, name: pkg.name!, version: pkg.version! });\nconst errorCatcherPath = join(__dirname, './error-catcher.mjs');\n\nexport class KnapsackReactRenderer\n extends RendererWebpackBase\n implements Renderable\n{\n /**\n * `react.js` & `react-dom.js` root relative paths\n */\n assets: string[];\n babelConfig: Record<string, unknown>;\n private demoWrapperPath: string;\n\n private disableReactStrictMode?: boolean;\n\n constructor({\n webpackConfig,\n demoWrapperPath = join(__dirname, './demo-wrapper.mjs'),\n id = rendererIds.react,\n disableReactStrictMode,\n }: {\n webpackConfig?: ConstructorParameters<\n typeof RendererWebpackBase\n >[0]['webpackConfig'];\n demoWrapperPath?: string;\n /** When using React v18+, this option allows a workspace to _disable_ React's Strict Mode from running in Knapsack's React Renderer (StrictMode is enabled by default).\n *\n * See https://reactjs.org/docs/strict-mode.html for more info\n * */\n disableReactStrictMode?: boolean;\n /** Don't set if calling from `knapsack.config.js`, only use if creating a new Renderer based on the React Renderer */\n id?: RendererId;\n } = {}) {\n super({\n id,\n language: 'jsx',\n webpackConfig,\n extraScripts: [\n // this is the code in `./client/init.mts`\n '@knapsack/renderer-react/client',\n ],\n codeSrcs: [demoWrapperPath, errorCatcherPath],\n });\n this.language = 'jsx';\n this.assets = [];\n this.demoWrapperPath = isAbsolute(demoWrapperPath)\n ? demoWrapperPath\n : this.resolvePathSync({\n path: demoWrapperPath,\n resolveFromDir: this.userConfigDir,\n }).absolutePath;\n assertFileExists(\n this.demoWrapperPath,\n `Could not find demo wrapper at: \"${this.demoWrapperPath}\"\\nPlease adjust setting in \"knapsack.config.js\" or pass a different path when creating the React Renderer.`,\n );\n this.disableReactStrictMode = disableReactStrictMode;\n this.creators = [createReactPattern];\n }\n\n init: Renderer['init'] = async () => {\n this.assets = await copyReactAssets(this.outputDir, this.publicPath);\n if (!(await fileExists(this.demoWrapperPath))) {\n throw new Error(\n `Could not find demo wrapper at: \"${this.demoWrapperPath}\"`,\n );\n }\n };\n\n getMeta: Renderer['getMeta'] = () => ({\n id: this.id,\n title: 'React',\n aliasUse: 'optional',\n aliasTitle: 'Named Export',\n aliasIsJsNamedExport: true,\n aliasDescription:\n 'If `export X` was used instead of `export default`, then provide X.',\n enableDataDemos: true,\n enableTemplateDemos: true,\n hasSlotsSupport: true,\n hasSlotOptionsSupport: true,\n version: pkg.version,\n hasInferSpecSupport: true,\n syntaxHighlightingLanguage: 'jsx',\n hasTemplateSuggestionsSupport: true,\n prototypingTemplate: {\n path: '@knapsack/renderer-react/prototype-template',\n spec: {\n isInferred: false,\n props: {\n type: 'object',\n properties: {},\n },\n slots: {\n children: { title: 'Children' },\n },\n },\n },\n });\n\n override changeCase: Renderer['changeCase'] = (str) => pascalCase(str);\n\n override createWebpackConfig: RendererWebpackBase['createWebpackConfig'] =\n () => {\n const config = super.createWebpackConfig();\n\n config.externals = {\n react: 'React',\n 'react-dom': 'ReactDOM',\n };\n\n return config;\n };\n\n async prepClientRenderResults({\n usage,\n demoApp,\n importMap,\n renderOptions: { demo, state, patternId, templateId },\n }: {\n usage: string;\n demoApp: string;\n importMap: KsJsImportMap;\n renderOptions: Parameters<Renderer['render']>[0];\n }): ReturnType<Renderer['render']> {\n const meta = {\n demo,\n disableReactStrictMode: this.disableReactStrictMode,\n neededImportsByPath: convertImportMapToNeededImportsByPath(importMap),\n extraImports: {\n DemoWrapper: {\n type: 'default',\n path: this.demoWrapperPath,\n name: 'DemoWrapper',\n },\n ErrorCatcher: {\n type: 'default',\n path: errorCatcherPath,\n name: 'ErrorCatcher',\n },\n },\n demoWrapperProps: {\n patternId,\n templateId,\n demo,\n },\n } as const satisfies KsReactMeta;\n\n let code = `\n window.knapsack = window.knapsack || {};\n window.knapsack.getDemoApp = ({ ${[...importMap.keys()].join(', ')} }) => {\n ${demoApp}\n return ${demoAppName}\n }\n `;\n\n let errorHtmlMsg = '';\n try {\n code = await babelCodeForBrowser({ code });\n } catch (e) {\n console.log(code);\n console.log('---original code before babel error ^---');\n console.trace(e.message);\n code = `console.error(${JSON.stringify(e.message)});`;\n errorHtmlMsg = `<pre><code>${e.message}</code></pre>`;\n }\n\n const html = `\n <script type=\"application/json\" id=\"${rendererMetaScriptTagId}\">${JSON.stringify(\n meta,\n )}</script>\n <script type=\"application/javascript\">${code}</script>\n <div id=\"render-root\" class=\"knapsack-pattern-direct-parent\" data-dev-note=\"Knapsack React Template Wrapper\"></div>\n ${this.assets.map((asset) => `<script src=\"${asset}\"></script>`).join('\\n')}\n ${RendererWebpackBase.createHtmlTagsForAssetPaths({\n assets: this.getWebpackAssetPaths(),\n // we need the scripts to finish adding methods to the global knapsack object synchronously before the client-side code runs that is in the <script> tag below\n scriptTagsAreAsync: false,\n })}\n ${errorHtmlMsg}\n `;\n\n return {\n ok: !errorHtmlMsg,\n html: await formatCode({\n contents: html,\n path: 'x.html', // doing this to set format language\n }),\n usage,\n templateLanguage: this.language,\n };\n }\n\n render: Renderer['render'] = async (opt) => {\n if (opt.demo?.type === 'template') {\n // when getting a template demos path sometimes we have a race condition where the client asks for it before the server knows about it.\n // so we try several times in a row to get it\n /** The amount of time in ms to wait between attempts; when we run out of array items, we give up and throw the error */\n const waits = [5, 10, 20, 50, 100, 1000, 1000];\n let templateDemoPath: string;\n let attempt = 0;\n\n while (true) {\n try {\n const { absolutePath, exists } = await this.resolvePath(\n opt.demo.templateInfo.path,\n );\n if (!exists) {\n throw new Error(\n `Template demo file does not exist: ${absolutePath}`,\n );\n }\n templateDemoPath = absolutePath;\n // got it!\n break;\n } catch (e) {\n const waitTime = waits[attempt];\n if (!waitTime) {\n throw new Error(e);\n }\n attempt += 1;\n // eslint-disable-next-line no-await-in-loop\n await sleep(waitTime);\n }\n }\n const [templateFileContents, { usage, importMap }] = await Promise.all([\n readFile(templateDemoPath),\n this.getUsageAndImports({\n ...opt,\n importMap: new Map(),\n }),\n ]);\n const demoApp = await getDemoAppUsage({\n children: usage,\n });\n const results = await this.prepClientRenderResults({\n usage: templateFileContents,\n demoApp,\n renderOptions: opt,\n importMap,\n });\n\n return results;\n }\n\n if (opt.demo?.type === 'data') {\n const { usage, importMap } = await this.getUsageAndImports({\n ...opt,\n importMap: new Map(),\n });\n const importCode = RendererWebpackBase.createJsImportCodeBlock({\n importMap,\n });\n const [demoAppUsage, demoApp] = await Promise.all([\n getDemoAppUsage({\n children: usage,\n imports: importCode,\n format: true,\n }),\n getDemoAppUsage({\n children: usage,\n }),\n ]);\n\n return this.prepClientRenderResults({\n demoApp,\n usage: demoAppUsage,\n renderOptions: opt,\n importMap,\n });\n }\n };\n\n getUsageAndImports: RendererWebpackBase['getUsageAndImports'] = async ({\n patternId,\n templateId,\n demo,\n state,\n importMap,\n }) => {\n if (!demo) {\n throw new Error(\n `No demo provided while rendering ${patternId} ${templateId}`,\n );\n }\n const pattern = state.patterns[patternId];\n if (!pattern) {\n throw new Error(`Could not find pattern: ${patternId}`);\n }\n if (demo.type === 'data') {\n const template = pattern.templates.find((t) => t.id === templateId);\n if (!template) {\n throw new Error(`Could not find template: ${templateId}`);\n }\n const {\n data: { props, slots, slotsOptionsComputed },\n } = demo;\n const { name: templateName } = await this.addUniqueValueToImportMap({\n importMap,\n path: template.path,\n alias: template.alias || 'default',\n });\n\n const children: string[] = [];\n const extraProps: { key: string; value: string }[] = [];\n\n if (slots) {\n const slotNames = Object.keys(slots);\n const slotUsages = await Promise.all(\n slotNames.map(async (slotName) => {\n const slotItems = slots[slotName];\n const slotItemsUsages = await Promise.all(\n slotItems\n // remove any incomplete item - happens when users are filling out form\n .filter((slotItem) => {\n if (!slotItem) return false;\n if (slotItem.type !== 'text') {\n if (!slotItem.patternId) return false;\n if (!slotItem.templateId) return false;\n if (slotItem.type === 'template-demo' && !slotItem.demoId) {\n return false;\n }\n }\n return true;\n })\n .map(async (slotItem) => {\n if (slotItem.type === 'text') {\n if (slotItems.length === 1 && slotName !== 'children') {\n // The ` prevents multi-line strings from causing error (even though they don't show a line break)\n return `\\`${slotItem.text}\\``;\n }\n return slotItem.text;\n }\n if (slotItem.type === 'template-reference') {\n const slottedTemplate = state.patterns[\n slotItem.patternId\n ]?.templates.find((t) => t.id === slotItem.templateId);\n if (!slottedTemplate) {\n throw new Error(\n `Could not find slotted template: ${slotItem.patternId} ${slotItem.templateId}`,\n );\n }\n const templateRefImport =\n await this.addUniqueValueToImportMap({\n importMap,\n path: slottedTemplate.path,\n alias: slottedTemplate.alias || 'default',\n });\n /**\n * i.e. Given a React Component, `Button`, normally this would be `<Button>` with a demo, but since there is none this will just be a reference to it: `Button`\n * @see {KsSlotInfo['isTemplateReference']}\n * @see {SlottedTemplate}\n */\n return templateRefImport.name;\n }\n if (slotItem.type === 'template-demo') {\n const thisDemo = slotItem.demo;\n if (!thisDemo) {\n throw new Error(\n `Could not find slotted template demo ${JSON.stringify(\n slotItem,\n )}`,\n );\n }\n const { usage } = await this.getUsageAndImports({\n patternId: thisDemo.patternId,\n templateId: thisDemo.templateId,\n demo: thisDemo,\n state,\n importMap,\n });\n return usage;\n }\n const _exhaustiveCheck: never = slotItem;\n throw new Error(\n `Unknown slot item: ${JSON.stringify(slotItem)}`,\n );\n }),\n );\n return {\n slotName,\n slotItemsUsages,\n };\n }),\n );\n\n slotUsages.forEach(({ slotName, slotItemsUsages }) => {\n const slotOptionsComputed = slotsOptionsComputed?.[slotName];\n const { openTag, closeTag } = createSlotOptionsHtmlTags({\n slotOptionsComputed,\n classAttributeName: 'className',\n stylesValueType: 'object',\n });\n if (openTag) {\n if (slotName === 'children') {\n children.push(openTag);\n } else {\n extraProps.push({\n key: slotName,\n value: openTag,\n });\n }\n }\n\n slotItemsUsages.forEach((usage) => {\n if (slotName === 'children') {\n children.push(usage);\n } else {\n extraProps.push({\n key: slotName,\n value: usage,\n });\n }\n });\n\n if (closeTag) {\n if (slotName === 'children') {\n children.push(closeTag);\n } else {\n extraProps.push({\n key: slotName,\n value: closeTag,\n });\n }\n }\n });\n }\n\n const usage = await getUsage({\n templateName,\n props,\n children: children.join('\\n'),\n extraProps,\n });\n\n return {\n usage,\n importMap,\n };\n }\n\n if (demo.type === 'template') {\n const { templateInfo } = demo;\n const { name: templateName } = await this.addUniqueValueToImportMap({\n importMap,\n path: templateInfo.path,\n alias: templateInfo.alias || 'default',\n });\n const usage = await getUsage({ templateName });\n\n return {\n usage,\n importMap,\n };\n }\n\n const _exhaustiveCheck: never = demo;\n throw new Error(\n `Unhandled demo type for ${patternId}-${templateId}: ${JSON.stringify(\n demo,\n )}`,\n );\n };\n\n inferSpec: Renderer['inferSpec'] = async ({\n template,\n templatePath,\n }: {\n template: KnapsackPatternTemplate;\n templatePath: string;\n }): Promise<KsTemplateSpec | false> => {\n const spec = await getReactDocs({\n src: template.path,\n exportName: template.alias || 'default',\n resolveFromDir: this.config.data,\n });\n if (spec !== false) {\n const totalProps = Object.keys(spec?.props?.properties || {}).length;\n const totalSlots = Object.keys(spec?.slots || {}).length;\n if (totalProps === 0 && totalSlots === 0) {\n return false;\n }\n }\n return spec;\n };\n\n override watch: Renderer['watch'] = async () => {\n super.watch();\n knapsackEvents.onPatternTemplateChanged(() => {\n clearInferSpecCache();\n });\n };\n\n getTemplateMeta: Renderer['getTemplateMeta'] = async ({\n pattern,\n template,\n }) => {\n const files: KnapsackFile[] = [];\n if (template?.spec?.props) {\n const schema = JSON.parse(JSON.stringify(template.spec.props));\n if (template?.spec?.slots) {\n Object.entries(template.spec.slots).forEach(([id, info]) => {\n schema.properties[id] = {\n typeof: 'function',\n tsType: 'React.ReactNode',\n\n description: info.allowedPatternIds\n ? `${info.description}. Only use: ${info.allowedPatternIds.join(\n ', ',\n )}`\n : info.description,\n };\n schema.required = schema.required ?? [];\n if (info.isRequired) schema.required.push(id);\n });\n }\n const typeDefs =\n await KnapsackReactRenderer.convertSchemaToTypeScriptDefs({\n schema,\n title: `${this.changeCase(pattern.id)}Props`,\n // @todo pull in base url\n description: `[Knapsack Docs](http://localhost:3999/pattern/${pattern.id}/${template.id})`,\n patternId: pattern.id,\n templateId: template.id,\n postBanner: `import * as React from 'react';`,\n });\n\n files.push({\n contents: typeDefs,\n encoding: 'utf8',\n path: `${pattern.id}.${template.id}.spec.d.ts`,\n });\n files.push({\n contents: JSON.stringify(schema, null, ' '),\n encoding: 'utf8',\n path: `${pattern.id}.${template.id}.spec.json`,\n });\n }\n return files;\n };\n\n alterTemplateMetaFiles: Renderer['alterTemplateMetaFiles'] = async ({\n files,\n metaDir,\n }) => {\n const imports: string[] = [];\n\n const ext = '.spec.d.ts';\n files.forEach((file) => {\n if (file.path.endsWith(ext)) {\n const { base } = parse(file.path);\n const [patternId, templateId] = base.split('.');\n const isFirst = templateId === this.id;\n const exportName = this.changeCase(`${patternId}Props`);\n const exportNameWithTemplateId = this.changeCase(\n `${patternId}-${templateId}Props`,\n );\n imports.push(\n `export { ${\n isFirst\n ? exportName\n : `${exportName} as ${exportNameWithTemplateId}`\n } } from './${relative(metaDir, file.path).replace('.d.ts', '')}';`,\n );\n }\n });\n\n // extra line at end of file\n imports.push('');\n\n return [\n ...files,\n {\n contents: imports.join('\\n'),\n encoding: 'utf8',\n path: join(metaDir, 'react.d.ts'),\n },\n ];\n };\n\n getTemplateSuggestions: Renderer['getTemplateSuggestions'] = async ({\n newPath,\n state,\n }) => {\n const usedSuggestions = Object.values(state.patterns).reduce(\n (acc, { templateDemos, templates }) => {\n templates.forEach(({ path, alias, templateLanguageId }) => {\n if (templateLanguageId !== this.id) return;\n acc.push({ path, alias });\n });\n templateDemos.forEach(\n ({ templateInfo: { path, alias }, templateLanguageId }) => {\n if (templateLanguageId !== this.id) return;\n acc.push({ path, alias });\n },\n );\n return acc;\n },\n [] as TemplateSuggestion[],\n );\n\n const codeSrcs = new Set(this.getCodeSrcs());\n // don't suggest internal only paths\n codeSrcs.delete(this.demoWrapperPath);\n codeSrcs.delete(errorCatcherPath);\n\n const allPaths = [\n ...new Set([\n newPath,\n ...Object.keys(this.pkgPathAliases || {}),\n ...codeSrcs,\n ]),\n ];\n const allSuggestions: TemplateSuggestion[] = await Promise.all(\n allPaths.map(async (path): Promise<TemplateSuggestion[]> => {\n if (!path) return [];\n try {\n const { exports, errorMsg } = await getJsExportNames({\n path,\n resolveFromDir: this.dataDir,\n pkgPathAliases: this.pkgPathAliases,\n });\n if (errorMsg) {\n throw new Error(errorMsg);\n }\n return (\n exports\n // only allow names that start with a capital letter (i.e. React Component names)\n // will exclude helper functions and custom hooks\n .filter((e) => e === 'default' || isFirstLetterCapital(e))\n .map((name) => ({\n alias: name,\n path,\n }))\n );\n } catch (e) {\n // only want this showing with verbose since template suggestions are not critical\n log.verbose(\n `Error getting import names for ${path}: ${e.message}`,\n null,\n this.logPrefix,\n );\n return [];\n }\n }),\n ).then((results) => {\n // sadly `Promise.all` & `.flatMap` just don't work, so this:\n return results.flat();\n });\n\n const suggestions = allSuggestions.filter((s) => {\n return !usedSuggestions.find(\n (us) => us.alias === s.alias && us.path === s.path,\n );\n });\n\n return {\n suggestions,\n };\n };\n}\n","import { log } from '@knapsack/app';\nimport {\n getModulePkgJson,\n readFile,\n copy,\n formatCode,\n resolvePath,\n findUp,\n} from '@knapsack/file-utils';\nimport { removeWrappingDoubleQuotes } from '@knapsack/utils';\nimport path from 'path';\nimport type { Documentation } from 'react-docgen';\nimport type { ComponentDoc, ParserOptions } from 'react-docgen-typescript';\nimport { KsTemplateSpec, isNumberProp, isOptionsProp } from '@knapsack/types';\n\ntype GetSpecParams = {\n src: string;\n exportName?: string;\n};\n\n/**\n * The name of the type, which is usually corresponds to the function name in `React.PropTypes`. However, for types define with `oneOf`, we use `\"enum\"` and for `oneOfType` we use `\"union\"`. If a custom function is provided or the type cannot be resolved to anything of `React.PropTypes`, we use `\"custom\"`.\n */\ntype RdTypeName =\n | 'number'\n | 'string'\n | 'custom'\n | 'union'\n | 'bool'\n | 'node'\n | 'func';\n\n/**\n * Some types accept parameters which define the type in more detail (such as `arrayOf`, `instanceOf`, `oneOf`, etc). Those are stored in `<typeValue>`. The data type of `<typeValue>` depends on the type definition.\n */\ntype RdTypeValue = string;\n\ntype RdProps = {\n [prop: string]: {\n defaultValue?: {\n value: string;\n computed: boolean;\n };\n type: {\n name: RdTypeName;\n value?: RdTypeValue;\n raw?: string;\n };\n flowType?: string;\n tsType?: string;\n description?: string;\n required: boolean;\n };\n};\n\ntype RdResults = {\n /**\n * Name of function, class, or const\n */\n displayName: string;\n description?: string;\n props: RdProps;\n};\n\nfunction renderUsageTemplate({\n templateName,\n attributes,\n children,\n}: {\n templateName: string;\n attributes: string;\n children: string;\n}) {\n return `\n <${templateName}\n ${attributes}\n ${\n children\n ? `>\n ${children}\n </${templateName}>`\n : '/>'\n }\n `;\n}\nexport const demoAppName = 'DemoApp';\n\nfunction renderDemoAppTemplate({\n imports = '',\n children,\n}: {\n imports: string;\n children: string;\n}) {\n return `${imports}\n\nfunction ${demoAppName}() {\n return (\n ${children}\n )\n}\n`;\n}\n\nexport async function getUsage(data: {\n templateName: string;\n props?: Record<string, unknown>;\n children?: string;\n extraProps?: {\n key: string;\n value: string;\n }[];\n format?: boolean;\n}): Promise<string> {\n const props = Object.keys(data.props || {}).map((key) => {\n const value = data.props[key];\n return {\n key,\n value,\n };\n });\n\n const { templateName, children, extraProps = [] } = data;\n if (!templateName) {\n throw new Error(\n `Cannot getUsage of a React Component when no \"templateName\" is provided.`,\n );\n }\n\n const attributes: string[] = props.map(({ key, value }) => {\n switch (typeof value) {\n case 'string':\n // Is this a function like `() => {}` but not a \"sizes\" attribute for an image like `(min-width: 400px) 50vw, 100vw`?\n if (value.startsWith('(') && value.includes('=>')) {\n return `${key}={${value}}`;\n }\n return `${key}=\"${value}\"`;\n case 'boolean':\n return value ? `${key}` : `${key}={${value}}`;\n default:\n return `${key}={${JSON.stringify(value)}}`;\n }\n });\n\n const extraAttributes: string[] = [];\n const slotProps: { [key: string]: string[] } = {};\n\n extraProps.forEach(({ key, value }) => {\n slotProps[key] = slotProps[key] ?? [];\n slotProps[key].push(value);\n });\n\n Object.entries(slotProps).forEach(([key, values]) => {\n const value = values.length === 1 ? values[0] : `<>${values.join('\\n')}</>`;\n extraAttributes.push(`${key}={${value}}`);\n });\n\n const result = renderUsageTemplate({\n templateName,\n attributes: [...attributes, ...extraAttributes].join(' '),\n children,\n });\n return data.format\n ? formatCode({\n contents: result,\n path: 'x.tsx', // doing this to set format language\n })\n .then((code) => code.trim())\n .catch(() => result.trim()) // if format fails, just return the unformatted code\n : result.trim();\n}\n\nexport async function getDemoAppUsage({\n children,\n imports,\n format,\n}: {\n children: string;\n imports?: string;\n format?: boolean;\n}): Promise<string> {\n const code = renderDemoAppTemplate({\n children,\n imports,\n });\n if (!format) return code;\n return formatCode({\n contents: code,\n path: 'x.tsx', // doing this to set format language\n });\n}\n\nasync function getTypeScriptInfoFromFile({ src }: { src: string }): Promise<{\n info: ComponentDoc[];\n}> {\n const tsConfigPath = await findUp('tsconfig.json', {\n cwd: path.dirname(src),\n });\n const rdTs = await import('react-docgen-typescript');\n const config: ParserOptions = {\n shouldExtractLiteralValuesFromEnum: true,\n savePropValueAsString: true,\n skipChildrenPropWithoutDoc: false,\n // In addition to the ones listed here, which had not strangely included these below ~ https://github.com/styleguidist/react-docgen-typescript/blob/287e7012843cb26fed8f4bd8ee24e462c25a1414/src/parser.ts#L308\n customComponentTypes: ['VoidFunctionComponent', 'VFC'],\n };\n const parse = tsConfigPath\n ? rdTs.withCustomConfig(tsConfigPath, config).parse\n : rdTs.withDefaultConfig(config).parse;\n return {\n info: parse(src),\n };\n}\n\nfunction extractSpecFromTypeScriptInfo({\n info: results,\n exportName,\n}: {\n info: ComponentDoc[];\n exportName: string;\n}): KsTemplateSpec | false {\n try {\n if (!results) return false;\n const spec: KsTemplateSpec = {\n props: {\n $schema: 'http://json-schema.org/draft-07/schema',\n type: 'object',\n required: [],\n properties: {},\n },\n slots: {\n // children: {\n // title: 'children',\n // },\n },\n };\n\n const isDefaultExport = !exportName || exportName === 'default';\n\n // if `isDefaultExport` then we just grab last result since `export default` TENDS to be last. that'll we can do really...\n const result = isDefaultExport\n ? results.pop()\n : results.find((r) => r.displayName === exportName);\n\n // log.inspect({ result, isDefaultExport, exportName }, 'ts result');\n if (!result) return false;\n\n const { displayName } = result;\n // log.inspect({ result }, 'result');\n Object.entries(result?.props || {}).forEach(([propName, propDef]) => {\n const { name, description, defaultValue, required, type, parent } =\n propDef;\n\n // `type.name` can include `| undefined` if tsConfig has `strict: true`. So we need to handle these scenarios:\n // `string` or `string | undefined`\n // `'left' | 'right'` or `'left' | 'right' | undefined`\n const propType = type?.name\n ?.replace('| undefined', '')\n // remove generics. things like `FC<{}>` and `FC<Props>` should become `FC`\n .replace(/<.*/g, '')\n .trim();\n\n switch (propType) {\n case 'string':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'number':\n spec.props.properties[propName] = {\n type: 'number',\n };\n break;\n case 'boolean':\n case 'bool':\n if (defaultValue && 'value' in defaultValue) {\n // comes in as `'true'` - this turns it to `true`\n defaultValue.value = defaultValue.value === 'true';\n }\n spec.props.properties[propName] = {\n type: 'boolean',\n };\n break;\n case 'enum':\n type EnumType = {\n name: string;\n raw: string;\n value: {\n /** Looks like `'\"option1\"'` - beware of string that contains `\"` */\n value: string;\n }[];\n };\n spec.props.properties[propName] = {\n type: 'string',\n // yes there is a double \"value\" & yes it is confusing\n enum: [\n // ensure list is unique\n ...new Set<string>(\n (type as EnumType).value\n .map(({ value }) => removeWrappingDoubleQuotes(value?.trim()))\n .filter(Boolean),\n ),\n ],\n };\n break;\n case 'ReactNode':\n case 'React.ReactNode':\n case 'React.ReactElement':\n case 'ReactElement':\n spec.slots[propName] = {\n title: propName,\n };\n if (description) {\n spec.slots[propName] = {\n ...spec.slots[propName],\n description,\n };\n }\n break;\n case 'VFC':\n case 'FC':\n spec.slots[propName] = {\n title: propName,\n description: description || 'A reference to a component',\n isTemplateReference: true,\n allowOnlyOne: true,\n disallowText: true,\n };\n break;\n default: {\n if (type?.name?.startsWith('(')) {\n // functions\n spec.props.properties[propName] = {\n // description: `\\`${type.name}\\` ${description}`,\n typeof: 'function',\n tsType: propDef?.type?.name,\n };\n } else if (type?.name?.includes('|')) {\n // enums / unions (multi-choice strings)\n // comes in like this: `{ name: '\"option1\" | \"option2\" | \"option3\"' }`\n const options = type.name\n .split('|')\n .map((enumItem) => removeWrappingDoubleQuotes(enumItem.trim()))\n .filter(Boolean);\n\n if (options?.length) {\n spec.props.properties[propName] = {\n type: 'string',\n // ensuring list is unique\n enum: [...new Set(options)],\n };\n }\n } else {\n spec.props.properties[propName] = {\n tsType: propDef?.type?.name,\n };\n }\n }\n }\n\n // assigning info that all would have\n if (spec.props.properties[propName]) {\n if (required) spec.props.required.push(propName);\n if (description && !spec.props.properties[propName].description) {\n spec.props.properties[propName].description = description;\n }\n if (defaultValue && 'value' in defaultValue) {\n if (isNumberProp(spec.props.properties[propName])) {\n spec.props.properties[propName].default = parseFloat(\n defaultValue.value,\n );\n } else {\n spec.props.properties[propName].default =\n removeWrappingDoubleQuotes(defaultValue.value);\n }\n }\n }\n\n // console.log('type', type);\n });\n\n return spec;\n } catch (error) {\n log.verbose(\n 'Could not infer spec from React TypeScript file',\n {\n exportName,\n error,\n },\n 'react renderer',\n );\n return false;\n }\n}\n\nasync function getPropTypesInfoFromFile({ src }: { src: string }): Promise<{\n info: Documentation[];\n}> {\n const reactDocs = await import('react-docgen');\n const { builtinResolvers } = reactDocs;\n const fileSrc = await readFile(src);\n const { FindExportedDefinitionsResolver } = builtinResolvers;\n const results: Documentation[] = reactDocs.parse(fileSrc, {\n resolver: new FindExportedDefinitionsResolver(),\n handlers: null,\n filename: src,\n // babelrc: false,\n });\n return {\n info: results,\n };\n}\n\nfunction extractSpecFromPropTypesInfo({\n info: results,\n exportName,\n}: {\n info: Documentation[];\n exportName: string;\n}): KsTemplateSpec | false {\n try {\n const isDefaultExport = !exportName || exportName === 'default';\n\n // if `isDefaultExport` then we just grab last result since `export default` TENDS to be last. that'll we can do really...\n const result = isDefaultExport\n ? results.pop()\n : results.find((r) => r.displayName === exportName);\n\n // log.inspect(results, 'JSX PropTypes Results');\n // console.log(JSON.stringify(result, null, ' '));\n\n const spec: KsTemplateSpec = {\n isInferred: true,\n props: {\n $schema: 'http://json-schema.org/draft-07/schema',\n type: 'object',\n required: [],\n properties: {},\n },\n slots: {},\n };\n\n Object.entries(result?.props || {}).forEach(([propName, propDef]) => {\n const { required, description, defaultValue } = propDef;\n switch (propDef?.type?.name) {\n case 'string':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'func':\n spec.props.properties[propName] = {\n type: 'string',\n };\n break;\n case 'bool':\n spec.props.properties[propName] = {\n type: 'boolean',\n };\n break;\n case 'node':\n spec.slots[propName] = {\n title: propName,\n description,\n };\n }\n\n // assigning info that all would have\n if (spec.props.properties[propName]) {\n if (required) spec.props.required.push(propName);\n if (description && !spec.props.properties[propName].description) {\n spec.props.properties[propName].description = description;\n }\n if (defaultValue && 'value' in defaultValue) {\n spec.props.properties[propName].default =\n typeof defaultValue.value === 'string'\n ? removeWrappingDoubleQuotes(defaultValue.value)\n : defaultValue.value;\n }\n }\n });\n\n return spec;\n } catch (error) {\n log.verbose(\n 'Could not infer spec from React PropTypes',\n {\n exportName,\n error,\n },\n 'react renderer',\n );\n return false;\n }\n}\n\nfunction cleanUpSpec({\n spec,\n}: {\n spec: KsTemplateSpec | false;\n}): KsTemplateSpec | false {\n if (spec === false) return spec;\n // ok to mutate b/c spec was just created before passing in here\n Object.entries(spec?.props?.properties || {}).forEach(([propName, prop]) => {\n if (isOptionsProp(prop)) {\n // If the default is not in the enum, it should not be there\n // OR the enum is wrong\n if (!prop.enum.includes(prop.default)) {\n prop.default = undefined;\n }\n }\n });\n\n return spec;\n}\n\nasync function getReactModuleInfoUncached({\n src: unknownSrc,\n resolveFromDir,\n}: {\n src: string;\n resolveFromDir: string;\n}): Promise<\n | {\n type: 'typescript';\n info: ComponentDoc[];\n }\n | {\n type: 'propTypes';\n info: Documentation[];\n }\n | {\n type: 'unknown';\n }\n> {\n const typesInfo = await resolvePath({\n path: unknownSrc,\n resolveFromDir,\n resolveType: 'types',\n });\n if (typesInfo.exists) {\n const typeScriptInfo = await getTypeScriptInfoFromFile({\n src: typesInfo.absolutePath,\n });\n if (typeScriptInfo) {\n return {\n type: 'typescript',\n info: typeScriptInfo.info,\n };\n }\n }\n const jsInfo = await resolvePath({\n path: unknownSrc,\n resolveFromDir,\n });\n if (!jsInfo.exists) return { type: 'unknown' };\n const { ext } = path.parse(jsInfo.absolutePath);\n switch (ext) {\n case '.jsx': {\n const propTypesInfo = await getPropTypesInfoFromFile({\n src: jsInfo.absolutePath,\n });\n return {\n type: 'propTypes',\n info: propTypesInfo.info,\n };\n }\n case '.ts':\n case '.tsx': {\n const typeScriptInfo = await getTypeScriptInfoFromFile({\n src: jsInfo.absolutePath,\n });\n return {\n type: 'typescript',\n info: typeScriptInfo.info,\n };\n }\n default:\n return {\n type: 'unknown',\n };\n }\n}\n\nconst getReactModuleInfoCache = new Map<\n string,\n ReturnType<typeof getReactModuleInfoUncached>\n>();\nexport const clearInferSpecCache = () => {\n log.info(`Clearing React TypeScript inferSpec cache...`);\n getReactModuleInfoCache.clear();\n};\nasync function getReactModuleInfo(\n args: Parameters<typeof getReactModuleInfoUncached>[0],\n) {\n const cacheKey = JSON.stringify(args);\n if (!getReactModuleInfoCache.has(cacheKey)) {\n getReactModuleInfoCache.set(cacheKey, getReactModuleInfoUncached(args));\n }\n return getReactModuleInfoCache.get(cacheKey);\n}\n\nasync function getReactSpec({\n src,\n exportName,\n resolveFromDir,\n}: GetSpecParams & {\n resolveFromDir: string;\n}): Promise<KsTemplateSpec | false> {\n const reactModuleInfo = await getReactModuleInfo({\n src,\n resolveFromDir,\n });\n switch (reactModuleInfo.type) {\n case 'typescript':\n return extractSpecFromTypeScriptInfo({\n info: reactModuleInfo.info,\n exportName,\n });\n case 'propTypes':\n return extractSpecFromPropTypesInfo({\n info: reactModuleInfo.info,\n exportName,\n });\n case 'unknown':\n default:\n return false;\n }\n}\n\nexport async function getReactDocs(\n opt: GetSpecParams & {\n resolveFromDir: string;\n },\n): Promise<KsTemplateSpec | false> {\n return cleanUpSpec({\n spec: await getReactSpec(opt),\n });\n}\n\nexport async function copyReactAssets(\n distDirAbsolute: string,\n publicPath: string,\n): Promise<string[]> {\n try {\n const { version: reactVersion } = getModulePkgJson('react');\n const { version: reactDomVersion } = getModulePkgJson('react-dom');\n\n // switch to resolving the root NPM package dir vs the entire file via require.resolve\n // workaround due to NPM packages using the exports field; prevents these from being auto-resolved\n const reactRoot = path.dirname(\n require.resolve('react', {\n paths: [process.cwd()],\n }),\n );\n const reactDomRoot = path.dirname(\n require.resolve('react-dom', {\n paths: [process.cwd()],\n }),\n );\n await Promise.all([\n copy(\n path.join(reactRoot, 'umd/react.development.js'),\n path.join(distDirAbsolute, `react.development.${reactVersion}.js`),\n ),\n copy(\n path.join(reactRoot, 'umd/react.production.min.js'),\n path.join(distDirAbsolute, `react.production.min.${reactVersion}.js`),\n ),\n copy(\n path.join(reactDomRoot, 'umd/react-dom.production.min.js'),\n path.join(\n distDirAbsolute,\n `react-dom.production.min.${reactDomVersion}.js`,\n ),\n ),\n copy(\n path.join(reactDomRoot, 'umd/react-dom.development.js'),\n path.join(\n distDirAbsolute,\n `react-dom.development.${reactDomVersion}.js`,\n ),\n ),\n ]);\n const reactFileSuffix =\n process.env.NODE_ENV === 'production' ? 'production.min' : 'development';\n\n return [\n path.join(publicPath, `react.${reactFileSuffix}.${reactVersion}.js`),\n path.join(\n publicPath,\n `react-dom.${reactFileSuffix}.${reactDomVersion}.js`,\n ),\n ];\n } catch (error) {\n log.warn(\n 'Error trying to copy \"react\" and \"react-dom\" JS files, are they installed? We want to use your exact versions.',\n error,\n 'templateRenderer:react',\n );\n process.exit(1);\n }\n}\n","import { getJsExportNames } from '@knapsack/file-utils';\nimport { createCreator, tasks, Task } from '@knapsack/creator-utils';\nimport {\n readKsPatternConfigs,\n writeKsPatternConfig,\n readKsNavConfig,\n addKsNavItems,\n writeDemo,\n} from '@knapsack/ks-file-utils';\nimport { Demo, KnapsackPattern } from '@knapsack/types';\nimport { makeShortId } from '@knapsack/utils';\n\nfunction isCapitalLetter(char: string): boolean {\n return char.toUpperCase() === char;\n}\n\nfunction startsWithCapitalLetter(str: string): boolean {\n return isCapitalLetter(str[0]);\n}\n\nfunction createPatternData({\n importName,\n id,\n title = importName,\n pkgPath,\n initialDemoId,\n}: {\n importName: string;\n id: string;\n title?: string;\n pkgPath: string;\n initialDemoId: string;\n}): KnapsackPattern {\n return {\n id,\n title,\n description: '',\n statuses: {\n main: 'ready',\n },\n templates: [\n {\n id: 'react',\n title: 'react',\n path: pkgPath,\n alias: importName,\n templateLanguageId: 'react',\n spec: {\n isInferred: true,\n },\n demoIds: [initialDemoId],\n blockIds: [],\n },\n ],\n tabs: [\n {\n type: 'template',\n id: 'react',\n },\n ],\n subPages: [],\n };\n}\n\nexport const createReactPattern = createCreator({\n id: 'react-patterns',\n title: 'React Ks Patterns',\n description: 'Adds React templates as Knapsack Patterns',\n getQuestions: async () => ({\n pkgPath: {\n type: 'text',\n title: 'Package path',\n },\n importPrefix: {\n type: 'text',\n title: 'Import Prefix to Remove',\n },\n }),\n getTasks: async ({ answers: { pkgPath, importPrefix = '' }, config }) => {\n const dataDir = config.dest;\n const currentPatterns = await readKsPatternConfigs({\n dataDir,\n });\n const currentReactPatternsImportNames = currentPatterns.reduce(\n (cur, pattern) => {\n const reactTemplates =\n pattern.templates?.filter((t) => t.templateLanguageId === 'react') ??\n [];\n cur.push(...reactTemplates.map((t) => t.alias));\n return cur;\n },\n [] as string[],\n );\n const { exports: allImports } = await getJsExportNames({\n path: pkgPath,\n });\n return [\n {\n title: 'Pick Imports to add',\n task: (_, task) =>\n tasks.runSubCreator({\n task,\n config,\n creator: createCreator({\n id: 'react-pattern-import-names',\n getQuestions: async () => ({\n importNames: {\n type: 'choices',\n choices: allImports\n .filter(\n (importName) =>\n startsWithCapitalLetter(importName) &&\n !currentReactPatternsImportNames.includes(importName),\n )\n .map((importName) => ({\n value: importName,\n })),\n },\n }),\n getTasks: async ({ answers: { importNames } }) => {\n const patterns = importNames.map((importName) => ({\n importName,\n patternId: importName.startsWith(importPrefix)\n ? importName.slice(importPrefix.length).toLowerCase()\n : importName.toLowerCase(),\n }));\n return [\n ...patterns.map(\n ({ importName, patternId }): Task => ({\n title: `Add ${importName} React Template`,\n task: async (__, subTask) => {\n const initialDemo: Demo = {\n type: 'data',\n id: makeShortId(),\n title: 'Main',\n patternId,\n templateId: 'react',\n data: {\n props: {},\n slots: {},\n },\n };\n const pattern = createPatternData({\n id: patternId,\n importName,\n pkgPath,\n initialDemoId: initialDemo.id,\n });\n\n await Promise.all([\n writeDemo({\n dataDir,\n demo: initialDemo,\n }),\n writeKsPatternConfig({\n dataDir,\n patternId,\n data: pattern,\n }),\n ]);\n },\n }),\n ),\n {\n title: `Updating Nav`,\n task: async (__, subTask) => {\n const { byId } = await readKsNavConfig({\n dataDir,\n });\n // attempt to find a nav group to put patterns under\n const componentsGroup = Object.values(byId).find(\n ({ path, name, id }) => {\n // we only want groups (i.e. not pages or patterns)\n if (path) return false;\n if (name.toLowerCase() === 'patterns') return true;\n if (name.toLowerCase() === 'components') return true;\n return false;\n },\n );\n await addKsNavItems({\n dataDir,\n navItems: patterns.map(({ patternId }) => ({\n navId: patternId,\n navPath: `/pattern/${patternId}`,\n navParent: componentsGroup?.id || 'root',\n })),\n });\n },\n },\n ];\n },\n }),\n }),\n },\n ];\n },\n});\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n // patternsUsed: {\n // patternId: string;\n // templateId: string;\n // demoId?: string;\n // }[];\n demo: Demo;\n patternId: string;\n templateId: string;\n};\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase<'DemoWrapper' | 'ErrorCatcher'>;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAAkB;AAClB,mCAKO;AACP,IAAAA,gBAAiD;AACjD,IAAAC,cAAoC;AACpC,uBAIO;AACP,IAAAC,gBAOO;AACP,IAAAC,qBAOO;AACP,IAAAC,eAAkD;;;AC9BlD,iBAAoB;AACpB,wBAOO;AACP,mBAA2C;AAC3C,kBAAiB;AAGjB,mBAA4D;AAmD5D,SAAS,oBAAoB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,SAAO;AAAA,OACF,YAAY;AAAA,QACX,UAAU;AAAA,QAEV,WACI;AAAA,UACF,QAAQ;AAAA,UACR,YAAY,MACV,IACN;AAAA;AAEN;AApBS;AAqBF,IAAM,cAAc;AAE3B,SAAS,sBAAsB;AAAA,EAC7B,UAAU;AAAA,EACV;AACF,GAGG;AACD,SAAO,GAAG,OAAO;AAAA;AAAA,WAER,WAAW;AAAA;AAAA,MAEhB,QAAQ;AAAA;AAAA;AAAA;AAId;AAfS;AAiBT,eAAsB,SAAS,MASX;AAClB,QAAM,QAAQ,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ;AACvD,UAAM,QAAQ,KAAK,MAAM,GAAG;AAC5B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AAED,QAAM,EAAE,cAAc,UAAU,aAAa,CAAC,EAAE,IAAI;AACpD,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,QAAM,aAAuB,MAAM,IAAI,CAAC,EAAE,KAAK,MAAM,MAAM;AACzD,YAAQ,OAAO,OAAO;AAAA,MACpB,KAAK;AAEH,YAAI,MAAM,WAAW,GAAG,KAAK,MAAM,SAAS,IAA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E3C,aAAS,OAAO,KAAK,eAAe;AACpC,aAAS,OAAO,gBAAgB;AAEhC,UAAM,WAAW;AAAA,MACf,GAAG,oBAAI,IAAI;AAAA,QACT;AAAA,QACA,GAAG,OAAO,KAAK,KAAK,kBAAkB,CAAC,CAAC;AAAA,QACxC,GAAG;AAAA,MACL,CAAC;AAAA,IACH;AACA,UAAM,iBAAuC,MAAM,QAAQ;AAAA,MACzD,SAAS,IAAI,OAAOA,UAAwC;AAC1D,YAAI,CAACA,MAAM,QAAO,CAAC;AACnB,YAAI;AACF,gBAAM,EAAE,SAAAC,UAAS,SAAS,IAAI,UAAM,qCAAiB;AAAA,YACnD,MAAAD;AAAA,YACA,gBAAgB,KAAK;AAAA,YACrB,gBAAgB,KAAK;AAAA,UACvB,CAAC;AACD,cAAI,UAAU;AACZ,kBAAM,IAAI,MAAM,QAAQ;AAAA,UAC1B;AACA,iBACEC,SAGG,OAAO,CAAC,MAAM,MAAM,iBAAa,oCAAqB,CAAC,CAAC,EACxD,IAAI,CAAC,UAAU;AAAA,YACd,OAAO;AAAA,YACP,MAAAD;AAAA,UACF,EAAE;AAAA,QAER,SAAS,GAAG;AAEV,0BAAI;AAAA,YACF,kCAAkCA,KAAI,KAAK,EAAE,OAAO;AAAA,YACpD;AAAA,YACA,KAAK;AAAA,UACP;AACA,iBAAO,CAAC;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH,EAAE,KAAK,CAAC,YAAY;AAElB,aAAO,QAAQ,KAAK;AAAA,IACtB,CAAC;AAED,UAAM,cAAc,eAAe,OAAO,CAAC,MAAM;AAC/C,aAAO,CAAC,gBAAgB;AAAA,QACtB,CAAC,OAAO,GAAG,UAAU,EAAE,SAAS,GAAG,SAAS,EAAE;AAAA,MAChD;AAAA,IACF,CAAC;AAED,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF,GA/E6D;AAgF/D;","names":["import_utils","import_app","import_types","import_file_utils","import_path","path","parse","import_file_utils","import_utils","path","fileExists","sleep","usage","_exhaustiveCheck","path","exports"]}
|