@contember/react-binding 2.0.0-alpha.18 → 2.0.0-alpha.19

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.
@@ -7,7 +7,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
7
7
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
8
8
  class MarkerStaticAnalyzer {
9
9
  processChildren(children, env) {
10
- return IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(this.processNode(children, env, []));
10
+ const markers = this.processNode(children, env, []);
11
+ if (markers.length === 0) {
12
+ return void 0;
13
+ }
14
+ return IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(markers);
11
15
  }
12
16
  processNode(node, env, componentPath) {
13
17
  if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerStaticAnalyzer.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":["IncrementalMarkerBuilder","props","key","value"],"mappings":";;;;;;;AAcO,MAAM,qBAA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AAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;;"}
1
+ {"version":3,"file":"MarkerStaticAnalyzer.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer | undefined {\n\t\tconst markers = this.processNode(children, env, [])\n\t\tif (markers.length === 0) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn IncrementalMarkerBuilder.build(markers)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":["IncrementalMarkerBuilder","props","key","value"],"mappings":";;;;;;;AAcO,MAAM,qBAAqB;AAAA,EAC1B,gBACN,UACA,KAC6E;AAC7E,UAAM,UAAU,KAAK,YAAY,UAAU,KAAK,CAAA,CAAE;AAC9C,QAAA,QAAQ,WAAW,GAAG;AAClB,aAAA;AAAA,IACR;AAC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AM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;;"}
@@ -5,7 +5,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
5
5
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
6
6
  class MarkerStaticAnalyzer {
7
7
  processChildren(children, env) {
8
- return IncrementalMarkerBuilder.build(this.processNode(children, env, []));
8
+ const markers = this.processNode(children, env, []);
9
+ if (markers.length === 0) {
10
+ return void 0;
11
+ }
12
+ return IncrementalMarkerBuilder.build(markers);
9
13
  }
10
14
  processNode(node, env, componentPath) {
11
15
  if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerStaticAnalyzer.js","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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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,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
1
+ {"version":3,"file":"MarkerStaticAnalyzer.js","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer | undefined {\n\t\tconst markers = this.processNode(children, env, [])\n\t\tif (markers.length === 0) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn IncrementalMarkerBuilder.build(markers)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":";;;;;AAcO,MAAM,qBAAqB;AAAA,EAC1B,gBACN,UACA,KAC6E;AAC7E,UAAM,UAAU,KAAK,YAAY,UAAU,KAAK,CAAA,CAAE;AAC9C,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K,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
@@ -10,6 +10,9 @@ class MarkerTreeGenerator {
10
10
  generate() {
11
11
  const analyzer = new MarkerStaticAnalyzer.MarkerStaticAnalyzer();
12
12
  const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
13
+ if (collectedMarkers === void 0) {
14
+ return new binding.MarkerTreeRoot(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
15
+ }
13
16
  if (collectedMarkers instanceof binding.EntityFieldMarkersContainer) {
14
17
  throw new binding.BindingError();
15
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":["Environment","MarkerStaticAnalyzer","EntityFieldMarkersContainer","BindingError","MarkerTreeRoot"],"mappings":";;;;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2BA,QAAA,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAIC,qBAAAA;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4BC,QAAAA,6BAA6B;AAC5D,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAIC,QAAe,eAAA,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAID,QAAA;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\t\tif (collectedMarkers === undefined) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":["Environment","MarkerStaticAnalyzer","MarkerTreeRoot","EntityFieldMarkersContainer","BindingError"],"mappings":";;;;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2BA,QAAA,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAIC,qBAAAA;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AACnF,QAAI,qBAAqB,QAAW;AACnC,aAAO,IAAIC,QAAe,eAAA,oBAAI,IAAO,GAAA,oBAAI,IAAK,CAAA;AAAA,IAC/C;AAEA,QAAI,4BAA4BC,QAAAA,6BAA6B;AAC5D,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAIF,QAAe,eAAA,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAIE,QAAA;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;;"}
@@ -1,4 +1,4 @@
1
- import { Environment, EntityFieldMarkersContainer, BindingError, MarkerTreeRoot } from "@contember/binding";
1
+ import { Environment, MarkerTreeRoot, EntityFieldMarkersContainer, BindingError } from "@contember/binding";
2
2
  import { MarkerStaticAnalyzer } from "./MarkerStaticAnalyzer.js";
3
3
  class MarkerTreeGenerator {
4
4
  constructor(sourceTree, environment = Environment.create()) {
@@ -8,6 +8,9 @@ class MarkerTreeGenerator {
8
8
  generate() {
9
9
  const analyzer = new MarkerStaticAnalyzer();
10
10
  const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
11
+ if (collectedMarkers === void 0) {
12
+ return new MarkerTreeRoot(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
13
+ }
11
14
  if (collectedMarkers instanceof EntityFieldMarkersContainer) {
12
15
  throw new BindingError();
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAI;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\t\tif (collectedMarkers === undefined) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAI;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AACnF,QAAI,qBAAqB,QAAW;AACnC,aAAO,IAAI,eAAe,oBAAI,IAAO,GAAA,oBAAI,IAAK,CAAA;AAAA,IAC/C;AAEA,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;"}
@@ -7,7 +7,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
7
7
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
8
8
  class MarkerStaticAnalyzer {
9
9
  processChildren(children, env) {
10
- return IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(this.processNode(children, env, []));
10
+ const markers = this.processNode(children, env, []);
11
+ if (markers.length === 0) {
12
+ return void 0;
13
+ }
14
+ return IncrementalMarkerBuilder.IncrementalMarkerBuilder.build(markers);
11
15
  }
12
16
  processNode(node, env, componentPath) {
13
17
  if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerStaticAnalyzer.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":["IncrementalMarkerBuilder","props","key","value"],"mappings":";;;;;;;AAcO,MAAM,qBAAqB;AAAA,EAC1B,gBACN,UACA,KACiE;AAC1D,WAAAA,yBAAA,yBAAyB,MAAM,KAAK,YAAY,UAAU,KAAK,CAAE,CAAA,CAAC;AAAA,EAC1E;AAAA,EAEQ,YACP,MACA,KACA,eACY;AACZ,QAAI,SAAS,SAAS,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW;AAC/I,aAAO;IACR;AACI,QAAA,OAAO,SAAS,YAAY;AACzB,YAAA,IAAI,sBAAsB,+PAE4C;AAAA,IAC7E;AAEI,QAAA,MAAM,QAAQ,IAAI,GAAG;AACjB,aAAA,KAAK,QAAQ,CAAW,YAAA,KAAK,YAAY,SAAS,KAAK,aAAa,CAAC;AAAA,IAC7E;AAEI,QAAA,EAAE,UAAU,OAAO;AACtB,aAAO;IACR;AAEA,QAAI,OAAO,KAAK,SAAS,YAAY,OAAO,KAAK,SAAS,UAAU;AAEnE,aAAO,KAAK,YAAY,KAAK,MAAM,UAAU,KAAK,aAAa;AAAA,IAChE;AAEgB,oBAAA,CAAC,GAAG,eAAe,IAAI;AAEvC,UAAM,kBAAkB,iBAAiB,KAAK,OAAQ,KAAK,KAAK,cAAyB;AAErF,QAAA;AACC,UAAA,yBAAyB,KAAK,MAAM;AACvC,cAAO,KAAK,KAAkC,oBAAoB,KAAK,OAAO,GAAG;AAAA,MAClF;AAAA,aACQ,GAAG;AACD,gBAAA,GAAG,iBAAiB,0BAA0B,aAAa;AAAA,IACtE;AACI,QAAA,wBAAwB,KAAK,MAAM;AACtC,aAAO,CAAE,KAAK,KAA4B,mBAAmB,KAAK,OAAO,GAAG,CAAC;AAAA,IAC9E;AACI,QAAA,W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AA,QAC1B;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACO,aAAA;AAAA,IAAA;AAEF,UAAA,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;;"}
1
+ {"version":3,"file":"MarkerStaticAnalyzer.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer | undefined {\n\t\tconst markers = this.processNode(children, env, [])\n\t\tif (markers.length === 0) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn IncrementalMarkerBuilder.build(markers)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":["IncrementalMarkerBuilder","props","key","value"],"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IAAA;AAEF,UAAA,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;;;"}
@@ -5,7 +5,11 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
5
5
  var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
6
6
  class MarkerStaticAnalyzer {
7
7
  processChildren(children, env) {
8
- return IncrementalMarkerBuilder.build(this.processNode(children, env, []));
8
+ const markers = this.processNode(children, env, []);
9
+ if (markers.length === 0) {
10
+ return void 0;
11
+ }
12
+ return IncrementalMarkerBuilder.build(markers);
9
13
  }
10
14
  processNode(node, env, componentPath) {
11
15
  if (node === false || node === void 0 || node === null || typeof node === "string" || typeof node === "number" || typeof node === "boolean") {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerStaticAnalyzer.js","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer {\n\t\treturn IncrementalMarkerBuilder.build(this.processNode(children, env, []))\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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":";;;;;AAcO,MAAM,qBAAqB;AAAA,EAC1B,gBACN,UACA,KACiE;AAC1D,WAAA,yBAAyB,MAAM,KAAK,YAAY,UAAU,KAAK,CAAE,CAAA,CAAC;AAAA,EAC1E;AAAA,EAEQ,YACP,MACA,KACA,eACY;AACZ,QAAI,SAAS,SAAS,SAAS,UAAa,SAAS,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY,OAAO,SAAS,WAAW;AAC/I,aAAO;IACR;AACI,QAAA,OAAO,SAAS,YAAY;AACzB,YAAA,IAAI,sBAAsB,+PAE4C;AAAA,IAC7E;AAEI,QAAA,MAAM,QAAQ,IAAI,GAAG;AACjB,aAAA,KAAK,QAAQ,CAAW,YAAA,KAAK,YAAY,SAAS,KAAK,aAAa,CAAC;AAAA,IAC7E;AAEI,QAAA,EAAE,UAAU,OAAO;AACtB,aAAO;IACR;AAEA,QAAI,OAAO,KAAK,SAAS,YAAY,OAAO,KAAK,SAAS,UAAU;AAEnE,aAAO,KAAK,YAAY,KAAK,MAAM,UAAU,KAAK,aAAa;AAAA,IAChE;AAEgB,oBAAA,CAAC,GAAG,eAAe,IAAI;AAEvC,UAAM,kBAAkB,iBAAiB,KAAK,OAAQ,KAAK,KAAK,cAAyB;AAErF,QAAA;AACC,UAAA,yBAAyB,KAAK,MAAM;AACvC,cAAO,KAAK,KAAkC,oBAAoB,KAAK,OAAO,GAAG;AAAA,MAClF;AAAA,aACQ,GAAG;AACD,gBAAA,GAAG,iBAAiB,0BAA0B,aAAa;AAAA,IACtE;AACI,QAAA,wBAAwB,KAAK,MAAM;AACtC,aAA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A;AAAAA,YACR;AAAA,UAAA;AAEU,oBAAA,IAAI,GAAG,IAAI,YAAY;AAAA,QAAA,QAC1B;AACP,oBAAU,IAAI,GAAG;AAAA,QAClB;AAAA,MACD;AACO,aAAA;AAAA,IAAA;AAEF,UAAA,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
1
+ {"version":3,"file":"MarkerStaticAnalyzer.js","sources":["../../../../../packages/react-binding/src/markers/MarkerStaticAnalyzer.ts"],"sourcesContent":["import React, { ReactElement, ReactNode } from 'react'\nimport { BranchMarkerProvider, EnvironmentDeltaProvider, LeafMarkerProvider, StaticRenderProvider } from './MarkerProvider'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '@contember/binding'\nimport { IncrementalMarkerBuilder } from './IncrementalMarkerBuilder'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerStaticAnalyzer {\n\tpublic processChildren(\n\t\tchildren: ReactNode,\n\t\tenv: Environment,\n\t): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer | undefined {\n\t\tconst markers = this.processNode(children, env, [])\n\t\tif (markers.length === 0) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn IncrementalMarkerBuilder.build(markers)\n\t}\n\n\tprivate processNode(\n\t\tnode: ReactNode,\n\t\tenv: Environment,\n\t\tcomponentPath: ReactElement[],\n\t): Markers[] {\n\t\tif (node === false || node === undefined || node === null || typeof node === 'string' || typeof node === 'number' || typeof node === 'boolean') {\n\t\t\treturn []\n\t\t}\n\t\tif (typeof node === 'function') {\n\t\t\tthrow new ChildrenAnalyzerError(`Render props (functions as React component children) are not supported within the schema. ` +\n\t\t\t\t`You have likely used a bare custom component as opposed to wrapping in with \\`Component\\` ` +\n\t\t\t\t`from the \\`@contember/admin\\` package. Please refer to the documentation.`)\n\t\t}\n\n\t\tif (Array.isArray(node)) {\n\t\t\treturn node.flatMap(subNode => this.processNode(subNode, env, componentPath))\n\t\t}\n\n\t\tif (!('type' in node)) {\n\t\t\treturn []\n\t\t}\n\n\t\tif (typeof node.type === 'symbol' || typeof node.type === 'string') {\n\t\t\t// Fragment, Portal or other non-component\n\t\t\treturn this.processNode(node.props.children, env, componentPath)\n\t\t}\n\n\t\tcomponentPath = [...componentPath, node]\n\n\t\tconst nodeDisplayName = 'displayName' in node.type ? (node.type.displayName as string) : '???'\n\n\t\ttry {\n\t\t\tif ('generateEnvironment' in node.type) {\n\t\t\t\tenv = (node.type as EnvironmentDeltaProvider).generateEnvironment(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static context factory', componentPath)\n\t\t}\n\t\tif ('generateLeafMarker' in node.type) {\n\t\t\treturn [(node.type as LeafMarkerProvider).generateLeafMarker(node.props, env)]\n\t\t}\n\t\tlet children: ReactNode = node.props.children\n\t\ttry {\n\t\t\tif ('staticRender' in node.type) {\n\t\t\t\tchildren = (node.type as StaticRenderProvider).staticRender(node.props, env)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\twrapError(e, nodeDisplayName, 'static render', componentPath)\n\t\t}\n\t\tconst processedChildren = this.processNode(children, env, componentPath)\n\t\tif ('generateBranchMarker' in node.type) {\n\t\t\tconst marker = IncrementalMarkerBuilder.build(processedChildren)\n\t\t\treturn [(node.type as BranchMarkerProvider).generateBranchMarker(node.props, marker, env)]\n\t\t}\n\t\treturn processedChildren\n\t}\n}\n\nexport class ChildrenAnalyzerError extends Error {\n\tpublic details?: string\n\n\tconstructor(message: string, options?: { cause: Error; details?: string }) {\n\t\tsuper(message, options)\n\t\tthis.details = options?.details\n\t}\n}\n\nconst 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\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\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: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,QAClB;AAAA,MACD;AACO,aAAA;AAAA,IAAA;AAEF,UAAA,gBAAgB,OAAO,GAAG,SAAS,YAAY,iBAAiB,GAAG,OAAQ,GAAG,KAAa,cAAc;AACzG,UAAA,eAAe,WAAW,KAAK;AAC/B,UAAA,SAAS,KAAK,OAAO,KAAK;AAChC,WAAO,GAAG,MAAM,IAAI,iBAAiB,KAAK,GAAG,YAAY;AAAA,EAAA,CACzD;AACD,QAAM,eAAe,iCAAiC,oBAAoB,OAAO,UAAU;AAAA,EAAM,EAAE,WAAW,eAAe;AAEvH,QAAA,IAAI,sBAAsB,cAAc;AAAA,IAC7C,OAAO;AAAA,IACP,SAAS;AAAA,EAAoB,cAAc,KAAK,IAAI,CAAC;AAAA,EAAA,CACrD;AACF;"}
@@ -10,6 +10,9 @@ class MarkerTreeGenerator {
10
10
  generate() {
11
11
  const analyzer = new MarkerStaticAnalyzer.MarkerStaticAnalyzer();
12
12
  const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
13
+ if (collectedMarkers === void 0) {
14
+ return new binding.MarkerTreeRoot(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
15
+ }
13
16
  if (collectedMarkers instanceof binding.EntityFieldMarkersContainer) {
14
17
  throw new binding.BindingError();
15
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":["Environment","MarkerStaticAnalyzer","EntityFieldMarkersContainer","BindingError","MarkerTreeRoot"],"mappings":";;;;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2BA,QAAA,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAIC,qBAAAA;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4BC,QAAAA,6BAA6B;AAC5D,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAIC,QAAe,eAAA,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAID,QAAA;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.cjs","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\t\tif (collectedMarkers === undefined) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":["Environment","MarkerStaticAnalyzer","MarkerTreeRoot","EntityFieldMarkersContainer","BindingError"],"mappings":";;;;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2BA,QAAA,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAIC,qBAAAA;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AACnF,QAAI,qBAAqB,QAAW;AACnC,aAAO,IAAIC,QAAe,eAAA,oBAAI,IAAO,GAAA,oBAAI,IAAK,CAAA;AAAA,IAC/C;AAEA,QAAI,4BAA4BC,QAAAA,6BAA6B;AAC5D,YAAM,IAAIC,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAIA,QAAa,aAAA;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAIF,QAAe,eAAA,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAIE,QAAA;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;;"}
@@ -1,4 +1,4 @@
1
- import { Environment, EntityFieldMarkersContainer, BindingError, MarkerTreeRoot } from "@contember/binding";
1
+ import { Environment, MarkerTreeRoot, EntityFieldMarkersContainer, BindingError } from "@contember/binding";
2
2
  import { MarkerStaticAnalyzer } from "./MarkerStaticAnalyzer.js";
3
3
  class MarkerTreeGenerator {
4
4
  constructor(sourceTree, environment = Environment.create()) {
@@ -8,6 +8,9 @@ class MarkerTreeGenerator {
8
8
  generate() {
9
9
  const analyzer = new MarkerStaticAnalyzer();
10
10
  const collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment);
11
+ if (collectedMarkers === void 0) {
12
+ return new MarkerTreeRoot(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Map());
13
+ }
11
14
  if (collectedMarkers instanceof EntityFieldMarkersContainer) {
12
15
  throw new BindingError();
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAI;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AAEnF,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;"}
1
+ {"version":3,"file":"MarkerTreeGenerator.js","sources":["../../../../../packages/react-binding/src/markers/MarkerTreeGenerator.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Alias } from '@contember/binding'\nimport {\n\tBindingError,\n\tEntityFieldMarkersContainer,\n\tEntityFieldsWithHoistablesMarker,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tEnvironment,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '@contember/binding'\nimport { MarkerStaticAnalyzer } from './MarkerStaticAnalyzer'\n\ntype Markers = FieldMarker | HasOneRelationMarker | EntityFieldMarkersContainer | EntityFieldsWithHoistablesMarker | HasManyRelationMarker\n\nexport class MarkerTreeGenerator {\n\n\tpublic constructor(private sourceTree: ReactNode, private environment: Environment = Environment.create()) {}\n\n\tpublic generate(): MarkerTreeRoot {\n\t\tconst analyzer = new MarkerStaticAnalyzer()\n\t\tconst collectedMarkers = analyzer.processChildren(this.sourceTree, this.environment)\n\t\tif (collectedMarkers === undefined) {\n\t\t\treturn new MarkerTreeRoot(new Map(), new Map())\n\t\t}\n\n\t\tif (collectedMarkers instanceof EntityFieldMarkersContainer) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.fields.markers.size) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.parentReference !== undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\tif (collectedMarkers.subTrees === undefined) {\n\t\t\tthrow new BindingError()\n\t\t}\n\n\t\tconst subTrees = collectedMarkers.subTrees\n\n\t\treturn new MarkerTreeRoot(subTrees, this.generatePlaceholdersByAliases(subTrees))\n\t}\n\n\tprivate generatePlaceholdersByAliases(\n\t\thoistedSubTrees: ReadonlyMap<string, EntitySubTreeMarker | EntityListSubTreeMarker>,\n\t): Map<Alias, string> {\n\t\tconst placeholders = new Map<Alias, string>()\n\n\t\tfor (const [placeholderName, subTree] of hoistedSubTrees) {\n\t\t\tconst aliases = subTree.parameters.alias\n\t\t\tif (aliases === undefined || aliases.size === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor (const alias of aliases) {\n\t\t\t\tconst existingPlaceholder = placeholders.get(alias)\n\t\t\t\tif (existingPlaceholder !== undefined) {\n\t\t\t\t\tif (existingPlaceholder === placeholderName) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Detected the same sub-tree alias '${alias}' referring to sub-trees with different parameters!`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tplaceholders.set(alias, placeholderName)\n\t\t\t}\n\t\t}\n\n\t\treturn placeholders\n\t}\n\n}\n"],"names":[],"mappings":";;AAkBO,MAAM,oBAAoB;AAAA,EAEzB,YAAoB,YAA+B,cAA2B,YAAY,UAAU;AAAhF,SAAA,aAAA;AAA+B,SAAA,cAAA;AAAA,EAAkD;AAAA,EAErG,WAA2B;AAC3B,UAAA,WAAW,IAAI;AACrB,UAAM,mBAAmB,SAAS,gBAAgB,KAAK,YAAY,KAAK,WAAW;AACnF,QAAI,qBAAqB,QAAW;AACnC,aAAO,IAAI,eAAe,oBAAI,IAAO,GAAA,oBAAI,IAAK,CAAA;AAAA,IAC/C;AAEA,QAAI,4BAA4B,6BAA6B;AAC5D,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,OAAO,QAAQ,MAAM;AACzC,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,oBAAoB,QAAW;AACnD,YAAM,IAAI,aAAa;AAAA,IACxB;AACI,QAAA,iBAAiB,aAAa,QAAW;AAC5C,YAAM,IAAI,aAAa;AAAA,IACxB;AAEA,UAAM,WAAW,iBAAiB;AAElC,WAAO,IAAI,eAAe,UAAU,KAAK,8BAA8B,QAAQ,CAAC;AAAA,EACjF;AAAA,EAEQ,8BACP,iBACqB;AACf,UAAA,mCAAmB;AAEzB,eAAW,CAAC,iBAAiB,OAAO,KAAK,iBAAiB;AACnD,YAAA,UAAU,QAAQ,WAAW;AACnC,UAAI,YAAY,UAAa,QAAQ,SAAS,GAAG;AAChD;AAAA,MACD;AACA,iBAAW,SAAS,SAAS;AACtB,cAAA,sBAAsB,aAAa,IAAI,KAAK;AAClD,YAAI,wBAAwB,QAAW;AACtC,cAAI,wBAAwB,iBAAiB;AAC5C;AAAA,UACD;AACA,gBAAM,IAAI;AAAA,YACT,qCAAqC,KAAK;AAAA,UAAA;AAAA,QAE5C;AACa,qBAAA,IAAI,OAAO,eAAe;AAAA,MACxC;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAED;"}
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { EntityFieldMarkersContainer, EntityFieldsWithHoistablesMarker, Environment } from '@contember/binding';
3
3
  export declare class MarkerStaticAnalyzer {
4
- processChildren(children: ReactNode, env: Environment): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer;
4
+ processChildren(children: ReactNode, env: Environment): EntityFieldsWithHoistablesMarker | EntityFieldMarkersContainer | undefined;
5
5
  private processNode;
6
6
  }
7
7
  export declare class ChildrenAnalyzerError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerStaticAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/markers/MarkerStaticAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EACN,2BAA2B,EAC3B,gCAAgC,EAChC,WAAW,EAIX,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,oBAAoB;IACzB,eAAe,CACrB,QAAQ,EAAE,SAAS,EACnB,GAAG,EAAE,WAAW,GACd,gCAAgC,GAAG,2BAA2B;IAIjE,OAAO,CAAC,WAAW;CAwDnB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;gBAEX,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAIzE"}
1
+ {"version":3,"file":"MarkerStaticAnalyzer.d.ts","sourceRoot":"","sources":["../../../src/markers/MarkerStaticAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAc,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EACN,2BAA2B,EAC3B,gCAAgC,EAChC,WAAW,EAIX,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,oBAAoB;IACzB,eAAe,CACrB,QAAQ,EAAE,SAAS,EACnB,GAAG,EAAE,WAAW,GACd,gCAAgC,GAAG,2BAA2B,GAAG,SAAS;IAQ7E,OAAO,CAAC,WAAW;CAwDnB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;gBAEX,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAIzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerTreeGenerator.d.ts","sourceRoot":"","sources":["../../../src/markers/MarkerTreeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAMN,WAAW,EAIX,cAAc,EACd,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,mBAAmB;IAEZ,OAAO,CAAC,UAAU;IAAa,OAAO,CAAC,WAAW;gBAA1C,UAAU,EAAE,SAAS,EAAU,WAAW,GAAE,WAAkC;IAElG,QAAQ,IAAI,cAAc;IAsBjC,OAAO,CAAC,6BAA6B;CA2BrC"}
1
+ {"version":3,"file":"MarkerTreeGenerator.d.ts","sourceRoot":"","sources":["../../../src/markers/MarkerTreeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAMN,WAAW,EAIX,cAAc,EACd,MAAM,oBAAoB,CAAA;AAK3B,qBAAa,mBAAmB;IAEZ,OAAO,CAAC,UAAU;IAAa,OAAO,CAAC,WAAW;gBAA1C,UAAU,EAAE,SAAS,EAAU,WAAW,GAAE,WAAkC;IAElG,QAAQ,IAAI,cAAc;IAyBjC,OAAO,CAAC,6BAA6B;CA2BrC"}