@contember/react-multipass-rendering 2.1.0-beta.2 → 2.2.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/development/src/ChildrenAnalyzer.cjs.map +1 -1
  2. package/dist/development/src/ChildrenAnalyzer.js.map +1 -1
  3. package/dist/development/src/helpers/getErrorMessage.cjs.map +1 -1
  4. package/dist/development/src/helpers/getErrorMessage.js.map +1 -1
  5. package/dist/development/src/helpers/wrapError.cjs.map +1 -1
  6. package/dist/development/src/helpers/wrapError.js.map +1 -1
  7. package/dist/development/src/nodeSpecs/BranchNode.cjs.map +1 -1
  8. package/dist/development/src/nodeSpecs/BranchNode.js.map +1 -1
  9. package/dist/development/src/nodeSpecs/Leaf.cjs.map +1 -1
  10. package/dist/development/src/nodeSpecs/Leaf.js.map +1 -1
  11. package/dist/production/src/ChildrenAnalyzer.cjs.map +1 -1
  12. package/dist/production/src/ChildrenAnalyzer.js.map +1 -1
  13. package/dist/production/src/helpers/getErrorMessage.cjs.map +1 -1
  14. package/dist/production/src/helpers/getErrorMessage.js.map +1 -1
  15. package/dist/production/src/helpers/wrapError.cjs.map +1 -1
  16. package/dist/production/src/helpers/wrapError.js.map +1 -1
  17. package/dist/production/src/nodeSpecs/BranchNode.cjs.map +1 -1
  18. package/dist/production/src/nodeSpecs/BranchNode.js.map +1 -1
  19. package/dist/production/src/nodeSpecs/Leaf.cjs.map +1 -1
  20. package/dist/production/src/nodeSpecs/Leaf.js.map +1 -1
  21. package/dist/types/BranchNodeList.d.ts +1 -1
  22. package/dist/types/BranchNodeList.d.ts.map +1 -1
  23. package/dist/types/ChildrenAnalyzer.d.ts +3 -3
  24. package/dist/types/ChildrenAnalyzer.d.ts.map +1 -1
  25. package/dist/types/ChildrenAnalyzerOptions.d.ts +1 -1
  26. package/dist/types/ChildrenAnalyzerOptions.d.ts.map +1 -1
  27. package/dist/types/LeafList.d.ts +1 -1
  28. package/dist/types/LeafList.d.ts.map +1 -1
  29. package/dist/types/helpers/getErrorMessage.d.ts +1 -1
  30. package/dist/types/helpers/getErrorMessage.d.ts.map +1 -1
  31. package/dist/types/helpers/index.d.ts +1 -1
  32. package/dist/types/helpers/index.d.ts.map +1 -1
  33. package/dist/types/index.d.ts +4 -4
  34. package/dist/types/index.d.ts.map +1 -1
  35. package/dist/types/nodeSpecs/BranchNode.d.ts +2 -2
  36. package/dist/types/nodeSpecs/BranchNode.d.ts.map +1 -1
  37. package/dist/types/nodeSpecs/Leaf.d.ts +1 -1
  38. package/dist/types/nodeSpecs/Leaf.d.ts.map +1 -1
  39. package/dist/types/nodeSpecs/index.d.ts +5 -5
  40. package/dist/types/nodeSpecs/index.d.ts.map +1 -1
  41. package/dist/types/nodeSpecs/types/index.d.ts +9 -9
  42. package/dist/types/nodeSpecs/types/index.d.ts.map +1 -1
  43. package/dist/types/tsconfig.tsbuildinfo +1 -1
  44. package/package.json +2 -2
  45. package/src/BranchNodeList.ts +1 -1
  46. package/src/ChildrenAnalyzer.ts +7 -7
  47. package/src/ChildrenAnalyzerOptions.ts +1 -1
  48. package/src/LeafList.ts +1 -1
  49. package/src/helpers/getErrorMessage.ts +1 -1
  50. package/src/helpers/index.ts +1 -1
  51. package/src/helpers/wrapError.ts +1 -1
  52. package/src/index.ts +4 -4
  53. package/src/nodeSpecs/BranchNode.ts +3 -3
  54. package/src/nodeSpecs/Leaf.ts +1 -1
  55. package/src/nodeSpecs/index.ts +5 -5
  56. package/src/nodeSpecs/types/index.ts +9 -9
  57. package/tests/cases/unit/childrenAnalyzer.spec.tsx +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenAnalyzer.cjs","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions'\nimport type { LeafList } from './LeafList'\nimport { getErrorMessage } from './helpers'\nimport { wrapError } from './helpers/wrapError'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer","ChildrenAnalyzerError","getErrorMessage","wrapError","assertNever"],"mappings":";;;;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,cAAc;AAAA,IACpB,OAAO;AACN,WAAK,cAAc,CAAA;AACnB,gBAAU;AAAA,IACX;AACA,SAAK,UAAU,EAAE,GAAGA,mBAAiB,gBAAgB,GAAG,QAAA;AAAA,EACzD;AAAA,EAEO,gBACN,UACA,sBACgE;AAChE,UAAM,YAAY,KAAK,YAAY,UAAU,sBAAsB,CAAA,CAAE;AAErE,UAAM,YAAuF,MAAM;AAAA,MACjG;AAAA,IAAA,IAEC,YACA,CAAC,SAAS;AAEb,WAAO,UAAU;AAAA,MAChB,CAAC,SAAyE,SAAS;AAAA,IAAA;AAAA,EAErF;AAAA,EAEQ,YACP,MACA,eACA,eAC+E;AAC/E,QAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;AAC3H,iBAAW,QAAQ,KAAK,QAAQ;AAC/B,cAAM,gBAAgB,KAAK;AAC3B,YAAI,cAAc,SAAS,WAAW;AACrC,gBAAM,EAAE,eAAe,QAAA,IAAY;AACnC,cAAI,kBAAkB,QAAW;AAChC,mBAAO,QAAQ,MAAM,aAAa;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AACA,UAAI,SAAS,SAAS,SAAS,UAAa,SAAS,MAAM;AAE1D,eAAO;AAAA,MACR;AACA,UAAI,CAAC,KAAK,QAAQ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AA8B,iBAAiB,GAAG,aAAa;AAAA,UACtF;AACA;AAAA,QACD;AAAA,QACA,KAAK,WAAW;AACf,gBAAM,EAAE,SAAS,cAAA,IAAkB;AACnC,cAAI,kBAAkB,UAAa,KAAK,SAAS,eAAe;AAC/D,gBAAI,sBAAsB,UAAa,CAAC,WAAW,QAAQ,qBAAqB;AAC/E,oBAAM,IAAIA,sBAAAA,sBAAsB,WAAW,QAAQ,0BAA0B;AAAA,YAC9E;AACA,mBAAO,QAAQ,MAAM,mBAAmB,aAAa;AAAA,UACtD;AACA;AAAA,QACD;AAAA,QACA;AACC,iBAAOG,UAAAA,YAAY,aAAa;AAAA,MAAA;AAAA,IAEnC;AAEA,QACC,CAAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAIH,sBAAAA,sBAAsBC,gBAAAA,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;;"}
1
+ {"version":3,"file":"ChildrenAnalyzer.cjs","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList.js'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError.js'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions.js'\nimport type { LeafList } from './LeafList.js'\nimport { getErrorMessage } from './helpers/index.js'\nimport { wrapError } from './helpers/wrapError.js'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs/index.js'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer","ChildrenAnalyzerError","getErrorMessage","wrapError","assertNever"],"mappings":";;;;;;;;;AAiB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Ae;AAC/D,gBAAI,sBAAsB,UAAa,CAAC,WAAW,QAAQ,qBAAqB;AAC/E,oBAAM,IAAIA,sBAAAA,sBAAsB,WAAW,QAAQ,0BAA0B;AAAA,YAC9E;AACA,mBAAO,QAAQ,MAAM,mBAAmB,aAAa;AAAA,UACtD;AACA;AAAA,QACD;AAAA,QACA;AACC,iBAAOG,UAAAA,YAAY,aAAa;AAAA,MAAA;AAAA,IAEnC;AAEA,QACC,CAAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAIH,sBAAAA,sBAAsBC,gBAAAA,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenAnalyzer.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions'\nimport type { LeafList } from './LeafList'\nimport { getErrorMessage } from './helpers'\nimport { wrapError } from './helpers/wrapError'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer"],"mappings":";;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI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AAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAI,sBAAsB,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;"}
1
+ {"version":3,"file":"ChildrenAnalyzer.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList.js'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError.js'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions.js'\nimport type { LeafList } from './LeafList.js'\nimport { getErrorMessage } from './helpers/index.js'\nimport { wrapError } from './helpers/wrapError.js'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs/index.js'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer"],"mappings":";;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,cAAc;AAAA,IACpB,OAAO;AACN,WAAK,cAAc,CAAA;AACnB,gBAAU;AAAA,IACX;AACA,SAAK,UAAU,EAAE,GAAGA,mBAAiB,gBAAgB,GAAG,QAAA;AAAA,EACzD;AAAA,EAEO,gBACN,UACA,sBACgE;AAChE,UAAM,YAAY,KAAK,YAAY,UAAU,sBAAsB,CAAA,CAAE;AAErE,UAAM,YAAuF,MAAM;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2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;;"}
1
+ {"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory.js'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorMessage.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;"}
1
+ {"version":3,"file":"getErrorMessage.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory.js'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrapError.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","ChildrenAnalyzerError"],"mappings":";;;;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAI,MAAM,eAAeA,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAIC,sBAAAA,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;"}
1
+ {"version":3,"file":"wrapError.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","ChildrenAnalyzerError"],"mappings":";;;;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAI,MAAM,eAAeA,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAIC,sBAAAA,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrapError.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":";;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAIC,eAAM,eAAeD,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
1
+ {"version":3,"file":"wrapError.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":";;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAIC,eAAM,eAAeD,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BranchNode.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode","ChildrenAnalyzerError"],"mappings":";;;;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAIC,sBAAAA,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGD,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;;"}
1
+ {"version":3,"file":"BranchNode.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\nimport type { BranchNodeOptions } from './BranchNodeOptions.js'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode","ChildrenAnalyzerError"],"mappings":";;;;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAIC,sBAAAA,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGD,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BranchNode.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode"],"mappings":";;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAI,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGA,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;"}
1
+ {"version":3,"file":"BranchNode.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\nimport type { BranchNodeOptions } from './BranchNodeOptions.js'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode"],"mappings":";;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAI,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGA,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Leaf.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;;"}
1
+ {"version":3,"file":"Leaf.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Leaf.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"Leaf.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenAnalyzer.cjs","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions'\nimport type { LeafList } from './LeafList'\nimport { getErrorMessage } from './helpers'\nimport { wrapError } from './helpers/wrapError'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer","ChildrenAnalyzerError","getErrorMessage","wrapError","assertNever"],"mappings":";;;;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,cAAc;AAAA,IACpB,OAAO;AACN,WAAK,cAAc,CAAA;AACnB,gBAAU;AAAA,IACX;AACA,SAAK,UAAU,EAAE,GAAGA,mBAAiB,gBAAgB,GAAG,QAAA;AAAA,EACzD;AAAA,EAEO,gBACN,UACA,sBACgE;AAChE,UAAM,YAAY,KAAK,YAAY,UAAU,sBAAsB,CAAA,CAAE;AAErE,UAAM,YAAuF,MAAM;AAAA,MACjG;AAAA,IAAA,IAEC,YACA,CAAC,SAAS;AAEb,WAAO,UAAU;AAAA,MAChB,CAAC,SAAyE,SAAS;AAAA,IAAA;AAAA,EAErF;AAAA,EAEQ,YACP,MACA,eACA,eAC+E;AAC/E,QAAI,CAAC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BAAN;;"}
1
+ {"version":3,"file":"ChildrenAnalyzer.cjs","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList.js'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError.js'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions.js'\nimport type { LeafList } from './LeafList.js'\nimport { getErrorMessage } from './helpers/index.js'\nimport { wrapError } from './helpers/wrapError.js'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs/index.js'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer","ChildrenAnalyzerError","getErrorMessage","wrapError","assertNever"],"mappings":";;;;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,cAAc;AAAA,IACpB,OAAO;AACN,WAAK,cAAc,CAAA;AACnB,gBAAU;AAAA,IACX;AACA,SAAK,UAAU,EAAE,GAAGA,mBAAiB,gBAAgB,GAAG,QAAA;AAAA,EACzD;AAAA,EAEO,gBACN,UACA,sBACgE;AAChE,UAAM,YAAY,KAAK,YAAY,UAAU,sBAAsB,CAAA,CAAE;AAErE,UAAM,YAAuF,MAAM;AAAA,MACjG;AAAA,IAAA,IAEC,YACA,CAAC,SAAS;AAEb,WAAO,UAAU;AAAA,MAChB,CAAC,SAAyE,SAAS;AAAA,IAAA;AAAA,EAErF;AAAA,EAEQ,YACP,MACA,eACA,eAC+E;AAC/E,QAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;AAC3H,iBAAW,QAAQ,KAAK,QAAQ;AAC/B,cAAM,gBAAgB,KAAK;AAC3B,YAAI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AAA,IAAkC;AAE7D,cAAI,OAAO,aAAa,YAAY,qBAAqB,UAAU;AAClE,gBAAI,sBAAsB,UAAa,CAAC,WAAW,QAAQ,qBAAqB;AAC/E,oBAAM,IAAIH,sBAAAA,sBAAsB,WAAW,QAAQ,0BAA0B;AAAA,YAC9E;AACA,kBAAM,UAAU,SAAS,iBAAiB;AAM1C,mBAAO,QAAQ,OAAO,8BAA8B,iBAAiB,GAAG,aAAa;AAAA,UACtF;AACA;AAAA,QACD;AAAA,QACA,KAAK,WAAW;AACf,gBAAM,EAAE,SAAS,cAAA,IAAkB;AACnC,cAAI,kBAAkB,UAAa,KAAK,SAAS,eAAe;AAC/D,gBAAI,sBAAsB,UAAa,CAAC,WAAW,QAAQ,qBAAqB;AAC/E,oBAAM,IAAIA,sBAAAA,sBAAsB,WAAW,QAAQ,0BAA0B;AAAA,YAC9E;AACA,mBAAO,QAAQ,MAAM,mBAAmB,aAAa;AAAA,UACtD;AACA;AAAA,QACD;AAAA,QACA;AACC,iBAAOG,UAAAA,YAAY,aAAa;AAAA,MAAA;AAAA,IAEnC;AAEA,QACC,CAAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAIH,sBAAAA,sBAAsBC,gBAAAA,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenAnalyzer.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions'\nimport type { LeafList } from './LeafList'\nimport { getErrorMessage } from './helpers'\nimport { wrapError } from './helpers/wrapError'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer"],"mappings":";;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;AAnBF,kBAAA,MAAiB,QAAA;AACjB,kBAAA,MAAiB,aAAA;AACjB,kBAAA,MAAiB,SAAA;AAkBhB,SAAK,SAAS;AAEd,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,cAAc;AAAA,IACpB,OAAO;AACN,WAAK,cAAc,CAAA;AACnB,gBAAU;AAAA,IACX;AACA,SAAK,UAAU,EAAE,GAAGA,mBAAiB,gBAAgB,GAAG,QAAA;AAAA,EACzD;AAAA,EAEO,gBACN,UACA,sBACgE;AAChE,UAAM,YAAY,KAAK,YAAY,UAAU,sBAAsB,CAAA,CAAE;AAErE,UAAM,YAAuF,MAAM;AAAA,MACjG;AAAA,IAAA,IAEC,YACA,CAAC,SAAS;AAEb,WAAO,UAAU;AAAA,MAChB,CAAC,SAAyE,SAAS;AAAA,IAAA;AAAA,EAErF;AAAA,EAEQ,YACP,MACA,eACA,eAC+E;AAC/E,QAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY,OAAO,SAAS,aAAa,OAAO,SAAS,UAAU;AAC3H,iBAAW,QAAQ,KAAK,QAAQ;AAC/B,cAAM,gBAAgB,KAAK;AAC3B,YAAI,cAAc,SAAS,WAAW;AACrC,gBAAM,EAAE,eAAe,QAAA,IAAY;AACnC,cAAI,kBAAkB,QAAW;AAChC,mBAAO,QAAQ,MAAM,aAAa;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AACA,UAAI,SAAS,SAAS,SAAS,UAAa,SAAS,MAAM;AAE1D,eA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GAAG,aAAa;AAAA,UACtF;AACA;AAAA,QACD;AAAA,QACA,KAAK,WAAW;AACf,gBAAM,EAAE,SAAS,cAAA,IAAkB;AACnC,cAAI,kBAAkB,UAAa,KAAK,SAAS,eAAe;AAC/D,gBAAI,sBAAsB,UAAa,CAAC,WAAW,QAAQ,qBAAqB;AAC/E,oBAAM,IAAI,sBAAsB,WAAW,QAAQ,0BAA0B;AAAA,YAC9E;AACA,mBAAO,QAAQ,MAAM,mBAAmB,aAAa;AAAA,UACtD;AACA;AAAA,QACD;AAAA,QACA;AACC,iBAAO,YAAY,aAAa;AAAA,MAAA;AAAA,IAEnC;AAEA,QACC,CAAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAI,sBAAsB,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;"}
1
+ {"version":3,"file":"ChildrenAnalyzer.js","sources":["../../../../packages/react-multipass-rendering/src/ChildrenAnalyzer.ts"],"sourcesContent":["import { assertNever } from '@contember/utilities'\nimport type { ElementType, ReactElement, ReactNode } from 'react'\nimport type { BranchNodeList } from './BranchNodeList.js'\nimport { ChildrenAnalyzerError } from './ChildrenAnalyzerError.js'\nimport type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions.js'\nimport type { LeafList } from './LeafList.js'\nimport { getErrorMessage } from './helpers/index.js'\nimport { wrapError } from './helpers/wrapError.js'\nimport type {\n\tDeclarationSiteNodeRepresentationFactory,\n\tRawNodeRepresentation,\n\tStaticContextFactory,\n\tSyntheticChildrenFactory,\n\tUnconstrainedLeafRepresentationFactory,\n\tValidFactoryName,\n} from './nodeSpecs/index.js'\n\nexport class ChildrenAnalyzer<\n\tAllLeavesRepresentation = any,\n\tAllBranchNodesRepresentation = never,\n\tStaticContext = undefined,\n> {\n\tprivate static defaultOptions: ChildrenAnalyzerOptions = {\n\t\tignoreRenderProps: true,\n\t\trenderPropsErrorMessage: 'Render props (functions as React component children) are not supported.',\n\n\t\tignoreUnhandledNodes: true,\n\t\tunhandledNodeErrorMessage: 'Encountered an unknown child.',\n\n\t\tstaticContextFactoryName: 'getStaticContext',\n\t\tstaticRenderFactoryName: 'staticRender',\n\t}\n\n\tprivate readonly leaves: LeafList<AllLeavesRepresentation, StaticContext>\n\tprivate readonly branchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>\n\tprivate readonly options: ChildrenAnalyzerOptions<StaticContext>\n\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tbranchNodes: BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext>,\n\t\toptions?: Partial<ChildrenAnalyzerOptions>,\n\t)\n\tpublic constructor(\n\t\tleaves: LeafList<AllLeavesRepresentation, StaticContext>,\n\t\tdecider:\n\t\t\t| Partial<ChildrenAnalyzerOptions>\n\t\t\t| BranchNodeList<AllLeavesRepresentation, AllBranchNodesRepresentation, StaticContext> = [],\n\t\toptions: Partial<ChildrenAnalyzerOptions> = {},\n\t) {\n\t\tthis.leaves = leaves\n\n\t\tif (Array.isArray(decider)) {\n\t\t\tthis.branchNodes = decider\n\t\t} else {\n\t\t\tthis.branchNodes = []\n\t\t\toptions = decider\n\t\t}\n\t\tthis.options = { ...ChildrenAnalyzer.defaultOptions, ...options }\n\t}\n\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tinitialStaticContext: StaticContext,\n\t): Array<AllLeavesRepresentation | AllBranchNodesRepresentation> {\n\t\tconst processed = this.processNode(children, initialStaticContext, [])\n\n\t\tconst rawResult: Array<AllLeavesRepresentation | AllBranchNodesRepresentation | undefined> = Array.isArray(\n\t\t\t\tprocessed,\n\t\t\t)\n\t\t\t? processed\n\t\t\t: [processed]\n\n\t\treturn rawResult.filter(\n\t\t\t(item): item is AllLeavesRepresentation | AllBranchNodesRepresentation => item !== undefined,\n\t\t)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tstaticContext: StaticContext,\n\t\tcomponentPath: ReactElement[],\n\t): RawNodeRepresentation<AllLeavesRepresentation, AllBranchNodesRepresentation> {\n\t\tif (!node || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean' || typeof node === 'bigint') {\n\t\t\tfor (const leaf of this.leaves) {\n\t\t\t\tconst specification = leaf.specification\n\t\t\t\tif (specification.type === 'useSite') {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (node === false || node === undefined || node === null) {\n\t\t\t\t// This adds seamless support for conditionals and such.\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tif (!this.options.ignoreUnhandledNodes) {\n\t\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t\t}\n\t\t\treturn undefined\n\t\t}\n\n\t\tif (typeof node === 'function') {\n\t\t\tif (this.options.ignoreRenderProps) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.renderPropsErrorMessage, node, staticContext))\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\tlet mapped: Array<AllLeavesRepresentation | AllBranchNodesRepresentation> = []\n\n\t\t\tfor (const subNode of node) {\n\t\t\t\tconst processed = this.processNode(subNode, staticContext, componentPath)\n\n\t\t\t\tif (processed !== undefined) {\n\t\t\t\t\tif (Array.isArray(processed)) {\n\t\t\t\t\t\tmapped = mapped.concat(processed)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmapped.push(processed)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn mapped\n\t\t}\n\n\t\tlet children: ReactNode\n\n\t\tif (typeof node !== 'object' || !('type' in node)) {\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\tconst props = node.props as Record<string, any>\n\t\tchildren = props.children\n\n\t\tif (typeof node.type === 'symbol') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(children, staticContext, componentPath)\n\t\t}\n\t\t// if (typeof node.type === 'string') {\n\t\t// \t// Typically a host component\n\t\t// \tif (!this.options.ignoreUnhandledNodes) {\n\t\t// \t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t// \t}\n\t\t// \treturn this.processNode(children, staticContext)\n\t\t// }\n\n\t\t// Component, PureComponent, FunctionComponent\n\n\t\tconst treeNode = node.type as\n\t\t\t& ElementType\n\t\t\t& {\n\t\t\t\t[staticMethod in ValidFactoryName]:\n\t\t\t\t\t| StaticContextFactory<any, StaticContext>\n\t\t\t\t\t| SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\t\t| UnconstrainedLeafRepresentationFactory<any, AllLeavesRepresentation, StaticContext>\n\t\t\t\t\t| DeclarationSiteNodeRepresentationFactory<any, unknown, AllBranchNodesRepresentation, StaticContext>\n\t\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\t\tif (typeof treeNode !== 'string') {\n\t\t\tif (this.options.staticContextFactoryName in treeNode) {\n\t\t\t\tconst staticContextFactory = treeNode[this.options.staticContextFactoryName] as StaticContextFactory<\n\t\t\t\t\tany,\n\t\t\t\t\tStaticContext\n\t\t\t\t>\n\t\t\t\ttry {\n\t\t\t\t\tstaticContext = staticContextFactory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticContextFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.options.staticRenderFactoryName in treeNode) {\n\t\t\t\tconst factory = treeNode[this.options.staticRenderFactoryName] as SyntheticChildrenFactory<any, StaticContext>\n\t\t\t\ttry {\n\t\t\t\t\tchildren = factory(props, staticContext)\n\t\t\t\t} catch (e) {\n\t\t\t\t\twrapError(e, treeNode.displayName ?? '???', this.options.staticRenderFactoryName, componentPath)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const leaf of this.leaves) {\n\t\t\tconst specification = leaf.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as (\n\t\t\t\t\t\t\tprops: any,\n\t\t\t\t\t\t\tstaticContext: StaticContext,\n\t\t\t\t\t\t) => AllBranchNodesRepresentation | AllLeavesRepresentation\n\t\t\t\t\t\treturn factory(props, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { ComponentType, factory } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\treturn factory(node, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tconst processedChildren = this.processNode(children, staticContext, componentPath)\n\n\t\tfor (const branchNode of this.branchNodes) {\n\t\t\tconst specification = branchNode.specification\n\t\t\tswitch (specification.type) {\n\t\t\t\tcase 'declarationSite': {\n\t\t\t\t\tconst { factoryMethodName, childrenRepresentationReducer } = specification\n\n\t\t\t\t\tif (typeof treeNode !== 'string' && factoryMethodName in treeNode) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst factory = treeNode[factoryMethodName] as DeclarationSiteNodeRepresentationFactory<\n\t\t\t\t\t\t\tany,\n\t\t\t\t\t\t\tunknown,\n\t\t\t\t\t\t\tAllBranchNodesRepresentation | AllLeavesRepresentation,\n\t\t\t\t\t\t\tStaticContext\n\t\t\t\t\t\t>\n\t\t\t\t\t\treturn factory(props, childrenRepresentationReducer(processedChildren), staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase 'useSite': {\n\t\t\t\t\tconst { factory, ComponentType } = specification\n\t\t\t\t\tif (ComponentType === undefined || node.type === ComponentType) {\n\t\t\t\t\t\tif (processedChildren === undefined && !branchNode.options.childrenAreOptional) {\n\t\t\t\t\t\t\tthrow new ChildrenAnalyzerError(branchNode.options.childrenAbsentErrorMessage)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn factory(node, processedChildren, staticContext)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(specification)\n\t\t\t}\n\t\t}\n\n\t\tif (\n\t\t\t!this.options.ignoreUnhandledNodes\n\t\t\t&& !(typeof treeNode !== 'string' && this.options.staticRenderFactoryName in treeNode)\n\t\t) {\n\t\t\tthrow new ChildrenAnalyzerError(getErrorMessage(this.options.unhandledNodeErrorMessage, node, staticContext))\n\t\t}\n\n\t\treturn processedChildren\n\t}\n}\n"],"names":["_ChildrenAnalyzer"],"mappings":";;;;;;;AAiBO,MAAM,oBAAN,MAAMA,mBAIX;AAAA,EAyBM,YACN,QACA,UAE0F,CAAA,GAC1F,UAA4C,CAAA,GAC3C;A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AmB,aAAa;AAAA,UACtD;AACA;AAAA,QACD;AAAA,QACA;AACC,iBAAO,YAAY,aAAa;AAAA,MAAA;AAAA,IAEnC;AAEA,QACC,CAAC,KAAK,QAAQ,wBACX,EAAE,OAAO,aAAa,YAAY,KAAK,QAAQ,2BAA2B,WAC5E;AACD,YAAM,IAAI,sBAAsB,gBAAgB,KAAK,QAAQ,2BAA2B,MAAM,aAAa,CAAC;AAAA,IAC7G;AAEA,WAAO;AAAA,EACR;AACD;AA9OC,cALY,mBAKG,kBAA0C;AAAA,EACxD,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EAEzB,sBAAsB;AAAA,EACtB,2BAA2B;AAAA,EAE3B,0BAA0B;AAAA,EAC1B,yBAAyB;AAC1B,CAAA;AAdM,IAAM,mBAAN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;;"}
1
+ {"version":3,"file":"getErrorMessage.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory.js'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getErrorMessage.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;"}
1
+ {"version":3,"file":"getErrorMessage.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/getErrorMessage.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { ErrorMessageFactory } from '../ErrorMessageFactory.js'\n\nexport const getErrorMessage = <StaticContext>(\n\tfactory: ErrorMessageFactory<StaticContext>,\n\tnode: ReactNode,\n\tstaticContext: StaticContext,\n): string => {\n\treturn typeof factory === 'string' ? factory : factory(node, staticContext)\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAC9B,SACA,MACA,kBACY;AACZ,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ,MAAM,aAAa;AAC3E;"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrapError.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","ChildrenAnalyzerError"],"mappings":";;;;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAI,MAAM,eAAeA,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAIC,sBAAAA,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;"}
1
+ {"version":3,"file":"wrapError.cjs","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","ChildrenAnalyzerError"],"mappings":";;;;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAI,MAAM,eAAeA,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAIC,sBAAAA,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"wrapError.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":";;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAIC,eAAM,eAAeD,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
1
+ {"version":3,"file":"wrapError.js","sources":["../../../../../packages/react-multipass-rendering/src/helpers/wrapError.ts"],"sourcesContent":["import React, { ReactElement } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\n\nexport const wrapError = (e: unknown, currentComponentName: string, methodName: string, path: ReactElement[]): never => {\n\tif (!(e instanceof Error)) {\n\t\tthrow e\n\t}\n\n\tconst componentPath = path.map((it, index) => {\n\t\tconst { children, ...props } = it.props as Record<string, any>\n\t\tconst printProps = (props: any) => {\n\t\t\tlet result = ''\n\t\t\tfor (const [key, value] of Object.entries(props)) {\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tconst valuePrinted = JSON.stringify(value, (key, value) => {\n\t\t\t\t\t\tif (typeof value === 'function') {\n\t\t\t\t\t\t\treturn '(function)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (React.isValidElement(value)) {\n\t\t\t\t\t\t\treturn '(react element)'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value\n\t\t\t\t\t})\n\t\t\t\t\tresult += ` ${key}=${valuePrinted}`\n\t\t\t\t} catch {\n\t\t\t\t\tresult += ` ${key}=(failed to print a value)`\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}\n\t\tconst componentName = typeof it.type === 'object' && 'displayName' in it.type ? (it.type as any).displayName : null\n\t\tconst propsPrinted = printProps(props)\n\t\tconst indent = ' '.repeat(index)\n\t\treturn `${indent}<${componentName ?? '???'}${propsPrinted}>`\n\t})\n\tconst errorMessage = `Error during static render of ${currentComponentName} in ${methodName}:\\n${e.message || 'unknown error'}`\n\n\tthrow new ChildrenAnalyzerError(errorMessage, {\n\t\tcause: e,\n\t\tdetails: `Component path:\\n${componentPath.join('\\n')}`,\n\t})\n}\n"],"names":["props","key","value","React"],"mappings":";;AAGO,MAAM,YAAY,CAAC,GAAY,sBAA8B,YAAoB,SAAgC;AACvH,MAAI,EAAE,aAAa,QAAQ;AAC1B,UAAM;AAAA,EACP;AAEA,QAAM,gBAAgB,KAAK,IAAI,CAAC,IAAI,UAAU;AAC7C,UAAM,EAAE,UAAU,GAAG,MAAA,IAAU,GAAG;AAClC,UAAM,aAAa,CAACA,WAAe;AAClC,UAAI,SAAS;AACb,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQA,MAAK,GAAG;AACjD,YAAI,UAAU,QAAW;AACxB;AAAA,QACD;AACA,YAAI;AACH,gBAAM,eAAe,KAAK,UAAU,OAAO,CAACC,MAAKC,WAAU;AAC1D,gBAAI,OAAOA,WAAU,YAAY;AAChC,qBAAO;AAAA,YACR;AACA,gBAAIC,eAAM,eAAeD,MAAK,GAAG;AAChC,qBAAO;AAAA,YACR;AACA,mBAAOA;AAAAA,UACR,CAAC;AACD,oBAAU,IAAI,GAAG,IAAI,YAAY;AAAA,QAClC,QAAQ;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACA,aAAO;AAAA,IACR;AACA,UAAM,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AAC/G,UAAM,eAAe,WAAW,KAAK;AACrC,UAAM,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAC1D,CAAC;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAE7H,QAAM,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BranchNode.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode","ChildrenAnalyzerError"],"mappings":";;;;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAIC,sBAAAA,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGD,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;;"}
1
+ {"version":3,"file":"BranchNode.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\nimport type { BranchNodeOptions } from './BranchNodeOptions.js'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode","ChildrenAnalyzerError"],"mappings":";;;;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAIC,sBAAAA,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGD,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"BranchNode.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError'\nimport type { BranchNodeOptions } from './BranchNodeOptions'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode"],"mappings":";;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAI,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGA,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;"}
1
+ {"version":3,"file":"BranchNode.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/BranchNode.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport { ChildrenAnalyzerError } from '../ChildrenAnalyzerError.js'\nimport type { BranchNodeOptions } from './BranchNodeOptions.js'\nimport type { ChildrenRepresentationReducer, UseSiteBranchNodeRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass BranchNode<\n\tProps extends {} = {},\n\tStaticContext = undefined,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tChildrenRepresentation = any,\n\tReducedChildrenRepresentation = any,\n\tRepresentation = any,\n> {\n\tprivate static defaultOptions: BranchNodeOptions = {\n\t\tchildrenAreOptional: false,\n\t\tchildrenAbsentErrorMessage: 'Component must have children!',\n\t}\n\n\tpublic readonly specification: BranchNode.Specification<\n\t\tProps,\n\t\tStaticContext,\n\t\tFactoryMethodName,\n\t\tChildrenRepresentation,\n\t\tReducedChildrenRepresentation,\n\t\tRepresentation\n\t>\n\n\tpublic readonly options: BranchNodeOptions\n\n\tpublic constructor(\n\t\tfactoryMethodName: FactoryMethodName,\n\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tuseSiteFactory: UseSiteBranchNodeRepresentationFactory<\n\t\t\tProps,\n\t\t\tChildrenRepresentation,\n\t\t\tRepresentation,\n\t\t\tStaticContext\n\t\t>,\n\t\tComponentType?: ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t)\n\tpublic constructor(\n\t\tfactory:\n\t\t\t| FactoryMethodName\n\t\t\t| UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>,\n\t\tcomponentOrReducer?:\n\t\t\t| ChildrenRepresentationReducer<ChildrenRepresentation, ReducedChildrenRepresentation>\n\t\t\t| ElementType<Props>,\n\t\toptions?: Partial<BranchNodeOptions>,\n\t) {\n\t\tif (typeof factory !== 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t\tchildrenRepresentationReducer: componentOrReducer as ChildrenRepresentationReducer<\n\t\t\t\t\tChildrenRepresentation,\n\t\t\t\t\tReducedChildrenRepresentation\n\t\t\t\t>,\n\t\t\t}\n\t\t} else if (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tfactory,\n\t\t\t\tComponentType: componentOrReducer as ElementType<Props>,\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new ChildrenAnalyzerError('Invalid arguments')\n\t\t}\n\t\tthis.options = {\n\t\t\t...BranchNode.defaultOptions,\n\t\t\t...options,\n\t\t}\n\t}\n}\n\nnamespace BranchNode {\n\texport type Specification<\n\t\tProps extends {} = {},\n\t\tStaticContext = any,\n\t\tFactoryMethodName extends ValidFactoryName = string,\n\t\tChildrenRepresentation = any,\n\t\tReducedChildrenRepresentation = any,\n\t\tRepresentation = any,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t\tchildrenRepresentationReducer: ChildrenRepresentationReducer<\n\t\t\t\tChildrenRepresentation,\n\t\t\t\tReducedChildrenRepresentation\n\t\t\t>\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UseSiteBranchNodeRepresentationFactory<Props, ChildrenRepresentation, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { BranchNode }\n"],"names":["_BranchNode"],"mappings":";;;;AAKA,MAAM,cAAN,MAAMA,aAOJ;AAAA,EAgCM,YACN,SAGA,oBAGA,SACC;AAlCF,kBAAA,MAAgB,eAAA;AAShB,kBAAA,MAAgB,SAAA;AA0Bf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,QACnB,+BAA+B;AAAA,MAAA;AAAA,IAKjC,WAAW,OAAO,YAAY,YAAY;AACzC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,IAEjB,OAAO;AACN,YAAM,IAAI,sBAAsB,mBAAmB;AAAA,IACpD;AACA,SAAK,UAAU;AAAA,MACd,GAAGA,aAAW;AAAA,MACd,GAAG;AAAA,IAAA;AAAA,EAEL;AACD;AA/DC,cARK,aAQU,kBAAoC;AAAA,EAClD,qBAAqB;AAAA,EACrB,4BAA4B;AAC7B,CAAA;AAXD,IAAM,aAAN;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Leaf.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;;"}
1
+ {"version":3,"file":"Leaf.cjs","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Leaf.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"Leaf.js","sources":["../../../../../packages/react-multipass-rendering/src/nodeSpecs/Leaf.ts"],"sourcesContent":["import type { ElementType } from 'react'\nimport type { ConstrainedLeafRepresentationFactory, UnconstrainedLeafRepresentationFactory, ValidFactoryName } from './types/index.js'\n\nclass Leaf<\n\tProps extends {} = {},\n\tStaticContext = any,\n\tFactoryMethodName extends ValidFactoryName = string,\n\tRepresentation = any,\n> {\n\tpublic readonly specification: Leaf.Specification<FactoryMethodName, Representation, Props, StaticContext>\n\n\tpublic constructor(factoryMethodName: FactoryMethodName)\n\tpublic constructor(staticFactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>)\n\tpublic constructor(\n\t\tstaticFactory: ConstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType: ElementType<Props>,\n\t)\n\tpublic constructor(\n\t\tfactory: FactoryMethodName | UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>,\n\t\tComponentType?: ElementType<Props>,\n\t) {\n\t\tif (typeof factory === 'function') {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'useSite',\n\t\t\t\tComponentType,\n\t\t\t\tfactory,\n\t\t\t}\n\t\t} else {\n\t\t\tthis.specification = {\n\t\t\t\ttype: 'declarationSite',\n\t\t\t\tfactoryMethodName: factory,\n\t\t\t}\n\t\t}\n\t}\n}\n\nnamespace Leaf {\n\texport type Specification<\n\t\tFactoryMethodName extends ValidFactoryName,\n\t\tRepresentation,\n\t\tProps extends {},\n\t\tStaticContext,\n\t> =\n\t\t| {\n\t\t\ttype: 'declarationSite'\n\t\t\tfactoryMethodName: FactoryMethodName\n\t\t}\n\t\t| {\n\t\t\ttype: 'useSite'\n\t\t\tfactory: UnconstrainedLeafRepresentationFactory<Props, Representation, StaticContext>\n\t\t\tComponentType?: ElementType<Props>\n\t\t}\n}\n\nexport { Leaf }\n"],"names":[],"mappings":";;;AAGA,MAAM,KAKJ;AAAA,EASM,YACN,SACA,eACC;AAXF,kBAAA,MAAgB,eAAA;AAYf,QAAI,OAAO,YAAY,YAAY;AAClC,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MAAA;AAAA,IAEF,OAAO;AACN,WAAK,gBAAgB;AAAA,QACpB,MAAM;AAAA,QACN,mBAAmB;AAAA,MAAA;AAAA,IAErB;AAAA,EACD;AACD;"}
@@ -1,3 +1,3 @@
1
- import type { BranchNode, RawNodeRepresentation, ValidFactoryName } from './nodeSpecs';
1
+ import type { BranchNode, RawNodeRepresentation, ValidFactoryName } from './nodeSpecs/index.js';
2
2
  export type BranchNodeList<LeavesRepresentationUnion, BranchNodesRepresentationUnion, StaticContext> = BranchNode<any, StaticContext, ValidFactoryName, RawNodeRepresentation<LeavesRepresentationUnion, BranchNodesRepresentationUnion>, any, BranchNodesRepresentationUnion>[];
3
3
  //# sourceMappingURL=BranchNodeList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BranchNodeList.d.ts","sourceRoot":"","sources":["../../src/BranchNodeList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEtF,MAAM,MAAM,cAAc,CAAC,yBAAyB,EAAE,8BAA8B,EAAE,aAAa,IAAI,UAAU,CAChH,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,qBAAqB,CAAC,yBAAyB,EAAE,8BAA8B,CAAC,EAChF,GAAG,EACH,8BAA8B,CAC9B,EAAE,CAAA"}
1
+ {"version":3,"file":"BranchNodeList.d.ts","sourceRoot":"","sources":["../../src/BranchNodeList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE/F,MAAM,MAAM,cAAc,CAAC,yBAAyB,EAAE,8BAA8B,EAAE,aAAa,IAAI,UAAU,CAChH,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,qBAAqB,CAAC,yBAAyB,EAAE,8BAA8B,CAAC,EAChF,GAAG,EACH,8BAA8B,CAC9B,EAAE,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { BranchNodeList } from './BranchNodeList';
3
- import type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions';
4
- import type { LeafList } from './LeafList';
2
+ import type { BranchNodeList } from './BranchNodeList.js';
3
+ import type { ChildrenAnalyzerOptions } from './ChildrenAnalyzerOptions.js';
4
+ import type { LeafList } from './LeafList.js';
5
5
  export declare class ChildrenAnalyzer<AllLeavesRepresentation = any, AllBranchNodesRepresentation = never, StaticContext = undefined> {
6
6
  private static defaultOptions;
7
7
  private readonly leaves;
@@ -1 +1 @@
1
- {"version":3,"file":"ChildrenAnalyzer.d.ts","sourceRoot":"","sources":["../../src/ChildrenAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAY1C,qBAAa,gBAAgB,CAC5B,uBAAuB,GAAG,GAAG,EAC7B,4BAA4B,GAAG,KAAK,EACpC,aAAa,GAAG,SAAS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AE,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,EACxD,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;gBAG1C,MAAM,EAAE,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC,EACxD,WAAW,EAAE,cAAc,CAAC,uBAAuB,EAAE,4BAA4B,EAAE,aAAa,CAAC,EACjG,OAAO,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAoBpC,eAAe,CACrB,QAAQ,EAAE,SAAS,EACnB,oBAAoB,EAAE,aAAa,GACjC,KAAK,CAAC,uBAAuB,GAAG,4BAA4B,CAAC;IAchE,OAAO,CAAC,WAAW;CAmLnB"}
@@ -1,4 +1,4 @@
1
- import type { ErrorMessageFactory } from './ErrorMessageFactory';
1
+ import type { ErrorMessageFactory } from './ErrorMessageFactory.js';
2
2
  export interface ChildrenAnalyzerOptions<StaticContext = any> {
3
3
  ignoreRenderProps: boolean;
4
4
  renderPropsErrorMessage: ErrorMessageFactory<StaticContext>;