@next-core/runtime 1.49.12 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/internal/CustomTemplates/constants.js +2 -1
- package/dist/cjs/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js +2 -1
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js +11 -9
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/cjs/internal/FormRenderer/expandFormRenderer.js +2 -1
- package/dist/cjs/internal/FormRenderer/expandFormRenderer.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +8 -5
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/compute/evaluate.js +2 -1
- package/dist/cjs/internal/compute/evaluate.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/constants.js +1 -0
- package/dist/esm/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js +2 -1
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js +12 -10
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/esm/internal/FormRenderer/expandFormRenderer.js +2 -1
- package/dist/esm/internal/FormRenderer/expandFormRenderer.js.map +1 -1
- package/dist/esm/internal/Renderer.js +9 -6
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/compute/evaluate.js +2 -1
- package/dist/esm/internal/compute/evaluate.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/types/internal/CustomTemplates/constants.d.ts +2 -0
- package/dist/types/internal/interfaces.d.ts +1 -0
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","setMatchedRoute","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","iid","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n RouteConfOfBricks,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce, isEqual } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\nimport { setMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n path?: string;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequestNode?: MenuRequestNode;\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\n });\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n\n if (route.iid) {\n setMatchedRoute(route.iid, matched.match);\n }\n\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: Map<string, number>\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotFromIndexToSlotId = new Map<number, string>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) => {\n let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, newMatch.params))\n );\n })\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n true\n );\n\n // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\n if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\n );\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":"AAWA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,UAAU,EACVC,SAAS,QACJ,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,wBAAwB,QAAQ,6BAA6B;AACtE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACEC,+BAA+B,EAC/BC,wBAAwB,QACnB,oCAAoC;AAC3C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAEEC,u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AGD,aAAa;EAC5B;EACA,IACEE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,aAAa,IACtCxH,QAAQ,IACR,CAAC9E,KAAK,CAACC,OAAO,CAAC6E,QAAQ,CAAC,EACxB;IACA;IACAtE,OAAO,CAACqL,IAAI,CACV,yCAAyC,EACzC,IAAI,OAAO/G,QAAQ,GAAG,EACtBA,QACF,CAAC;EACH;EACA,IAAI9E,KAAK,CAACC,OAAO,CAAC6E,QAAQ,CAAC,IAAI,CAACqH,QAAQ,EAAE;IACxCA,QAAQ,GAAG,CAAC,CAAC;IACb,KAAK,MAAMlB,KAAK,IAAInG,QAAQ,EAAE;MAC5B,MAAMH,IAAI,GAAGsG,KAAK,CAACtG,IAAI,IAAI,EAAE;MAC7B,IAAI,CAAClJ,cAAc,CAAC0Q,QAAQ,EAAExH,IAAI,CAAC,EAAE;QACnCwH,QAAQ,CAACxH,IAAI,CAAC,GAAG;UACfxE,IAAI,EAAE,QAAQ;UACde,MAAM,EAAE;QACV,CAAC;MACH;MACCiL,QAAQ,CAACxH,IAAI,CAAC,CAAsBzD,MAAM,CAACvB,IAAI,CAACsL,KAAK,CAAC;IACzD;EACF;EACA,OAAOkB,QAAQ;AACjB;AAEA,SAASnF,SAASA,CAChBuF,OAAyB,EACzBpM,IAAsD,EACtDqM,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAnM,OAAO,CAACC,KAAK,CAAC,sBAAsB,EAAEN,IAAI,EAAEqM,IAAI,EAAEG,CAAC,CAAC;EACtD,CAAC,CAAC,GACFJ,OAAO;AACb","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":["enqueueStableLoadBricks","flushStableLoadBricks","loadBricksImperatively","loadProcessorsImperatively","loadScript","loadStyle","isTrackAll","hasOwnProperty","strictCollectMemberUsage","debounce","isEqual","asyncCheckBrickIf","asyncComputeRealPropertyEntries","constructAsyncProperties","resolveData","asyncComputeRealValue","listenOnTrackingContext","matchRoute","matchRoutes","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalForEachSize","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","expandCustomTemplate","getTagNameOfCustomTemplate","getTplStateStore","customTemplates","getBrickPackages","hooks","RenderTag","getTracks","isStrictMode","warnAboutStrictMode","FORM_RENDERER","symbolForFormStateStoreId","expandFormRenderer","isPreEvaluated","getPreEvaluatedRaw","matchHomepage","listenerFactory","setupRootRuntimeContext","httpErrorToString","setMatchedRoute","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","menuRequestReturnNode","slotId","isIncremental","matched","output","getEmptyRenderOutput","menuRequestNode","return","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","iid","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","checkPermissions","preCheckPermissionsForBrickOrRoute","value","preLoadBricks","Array","isArray","blockingList","type","redirectTo","redirect","resolved","transform","console","error","Error","menuRequest","loadMenu","menu","request","memoizeMenuRequestNode","newOutput","renderBricks","bricks","mergeRenderOutput","appendMenuRequestNode","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","arguments","length","legacyRenderBrick","errorBoundary","tag","BRICK","properties","textContent","dataset","style","color","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","formStateStoreId","forEachItem","forEachIndex","forEachSize","strict","brickName","startsWith","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","rawOutput","PLACEHOLDER","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","contextName","onChange","tplStateStore","registerArbitraryLifeCycle","test","get","catchLoad","unknownBricks","tplTagName","app","id","tplCount","set","includes","customElements","FormRendererElement","HTMLElement","$$typeof","formData","confProps","trackingContextList","asyncPropertyEntries","computedPropsFromHost","isScript","props","src","rel","href","prefix","window","PUBLIC_ROOT","attrs","events","portal","ref","usedProcessors","size","join","loadProperties","registerBrickLifeCycle","expandedBrickConf","childRuntimeContext","loadChildren","routeSlotFromIndexToSlotId","entries","_ref","childSlotId","slotConf","parentRoute","incrementalSubRoutes","performIncrementalRender","location","prevLocation","homepage","pathname","every","prevMatch","newMatch","params","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequestNodes","result","reCatch","childrenOutput","has","mergeSiblingRenderMenuRequest","child","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n RouteConfOfBricks,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce, isEqual } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalForEachSize,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n MenuRequestNode,\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\nimport type { MatchResult } from \"./matchPath.js\";\nimport { setupRootRuntimeContext } from \"./setupRootRuntimeContext.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\nimport { setMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n path?: string;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequestNode?: MenuRequestNode;\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n const menuRequestNode: MenuRequestNode = (output.menuRequestNode = {\n return: menuRequestReturnNode,\n });\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n\n if (route.iid) {\n setMatchedRoute(route.iid, matched.match);\n }\n\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n menuRequestNode.request = menuRequest;\n }\n\n if (!isIncremental) {\n rendererContext.memoizeMenuRequestNode(routes, menuRequestNode);\n }\n\n let newOutput: RenderOutput;\n if (route.type === \"routes\") {\n newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n } else {\n newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n menuRequestNode,\n slotId\n );\n }\n\n mergeRenderOutput(output, newOutput);\n appendMenuRequestNode(menuRequestNode, newOutput.menuRequestNode);\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n setupRootRuntimeContext(bricks, runtimeContext, true);\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n try {\n return await legacyRenderBrick(\n returnNode,\n brickConf,\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n } catch (error) {\n if (brickConf.errorBoundary) {\n // eslint-disable-next-line no-console\n console.error(\"Error caught by error boundary:\", error);\n return {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n };\n } else {\n throw error;\n }\n }\n}\n\nasync function legacyRenderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n keyPath: number[],\n tplStack: Map<string, number>\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEach*` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n runtimeContext.forEachSize = brickConf[symbolForTPlExternalForEachSize];\n } else if (brickConf[symbolForTPlExternalNoForEach]) {\n delete runtimeContext.forEachItem;\n delete runtimeContext.forEachIndex;\n delete runtimeContext.forEachSize;\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n delete childRuntimeContext.forEachSize;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotFromIndexToSlotId = new Map<number, string>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n tplStack\n );\n }\n\n const parentRoute = parentRoutes[parentRoutes.length - 1] as\n | RouteConfOfBricks\n | undefined;\n if (parentRoute?.incrementalSubRoutes) {\n routeSlotFromIndexToSlotId.set(index, childSlotId);\n rendererContext.performIncrementalRender(\n slotConf,\n parentRoutes,\n async (location, prevLocation) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) => {\n let prevMatch: MatchResult | null;\n let newMatch: MatchResult | null;\n return (\n (prevMatch = matchRoute(\n route,\n homepage,\n prevLocation.pathname\n )) &&\n (newMatch = matchRoute(route, homepage, pathname)) &&\n (route !== parentRoute ||\n isEqual(prevMatch.params, newMatch.params))\n );\n })\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId,\n true\n );\n\n // Do not ignore incremental rendering even if all sub-routes are missed.\n // Since parent route is matched.\n if (incrementalOutput.route) {\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [\n ...tplStateStoreScope,\n ...formStateStoreScope,\n ];\n await postAsyncRender(\n incrementalOutput,\n scopedRuntimeContext,\n [scopedRuntimeContext.ctxStore, ...scopedStores]\n );\n }\n\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequestNodes(\n menuRequestReturnNode,\n slotConf.routes,\n incrementalOutput.menuRequestNode\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n // When result is null, it means the incremental rendering is tried but routes missed.\n // In this case, we should continue to re-render the parent routes.\n return incrementalOutput.route ? true : null;\n }\n );\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequestNode: undefined,\n };\n rendered.forEach((item, index) => {\n if (routeSlotFromIndexToSlotId.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n routeSlotFromIndexToSlotId.get(index),\n [],\n item.node,\n brick\n );\n }\n mergeRenderOutput(childrenOutput, item);\n mergeSiblingRenderMenuRequest(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n\n appendMenuRequestNode(\n menuRequestReturnNode,\n (output.menuRequestNode = childrenOutput.menuRequestNode)\n );\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n menuRequestReturnNode: MenuRequestNode,\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const size = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n forEachSize: size,\n },\n rendererContext,\n parentRoutes,\n menuRequestReturnNode,\n slotId,\n keyPath.concat(i * size + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequestNode, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction mergeSiblingRenderMenuRequest(\n output: RenderOutput,\n newOutput: RenderOutput\n) {\n const menuRequestNode = newOutput.menuRequestNode;\n if (menuRequestNode) {\n if (output.menuRequestNode) {\n let last = output.menuRequestNode;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n output.menuRequestNode = menuRequestNode;\n }\n }\n}\n\nfunction appendMenuRequestNode(\n menuRequestReturnNode: MenuRequestNode,\n menuRequestNode: MenuRequestNode | undefined\n) {\n if (!menuRequestNode) {\n return;\n }\n if (menuRequestReturnNode.child) {\n let last = menuRequestReturnNode.child;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = menuRequestNode;\n } else {\n menuRequestReturnNode.child = menuRequestNode;\n }\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return { blockingList: [] };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load %s \"%s\" failed:`, type, name, e);\n })\n : promise;\n}\n"],"mappings":"AAWA,SACEA,uBAAuB,EACvBC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,UAAU,EACVC,SAAS,QACJ,mBAAmB;AAC1B,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,wBAAwB,QAAQ,6BAA6B;AACtE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SACEC,+BAA+B,EAC/BC,wBAAwB,QACnB,oCAAoC;AAC3C,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAEEC,uBAAuB,QAClB,sCAAsC;AAE7C,SAASC,UAAU,EAAEC,WAAW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|
261
261
|
case "ITEM":
|
|
262
262
|
case "INDEX":
|
|
263
|
+
case "SIZE":
|
|
263
264
|
{
|
|
264
|
-
const property = variableName === "ITEM" ? "forEachItem" : "forEachIndex";
|
|
265
|
+
const property = variableName === "ITEM" ? "forEachItem" : variableName === "INDEX" ? "forEachIndex" : "forEachSize";
|
|
265
266
|
if (!hasOwnProperty(runtimeContext, property)) {
|
|
266
267
|
// eslint-disable-next-line no-console
|
|
267
268
|
console.error(`Using \`${variableName}\` but no \`:forEach\` is found, check your expression: "${raw}"`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","names":["cook","preevaluate","shouldAllowRecursiveEvaluations","loadProcessorsImperatively","supply","hasOwnProperty","strictCollectMemberUsage","collectAppGetMenuUsage","collectInstalledAppsHasUsage","cloneDeep","omit","customProcessors","checkPermissionsUsage","storyboardFunctions","getGeneralGlobals","getDynamicReadOnlyProxy","getReadOnlyProxy","devtoolsHookEmit","getDevHook","getMedia","getStorageItem","_internalApiGetStoryboardInBootstrapData","getBrickPackages","getRuntime","hooks","getTplStateStore","widgetFunctions","widgetI18nFactory","hasInstalledApp","isStrictMode","warnAboutStrictMode","getFormStateStore","resolveData","asyncComputeRealValue","symbolForRaw","Symbol","for","symbolForContext","isPreEvaluated","raw","getPreEvaluatedRaw","pre","shouldDismissMarkingComputed","possibleErrorConstructs","WeakSet","SyntaxError","TypeError","ReferenceError","getCookErrorConstructor","error","has","constructor","asyncEvaluate","runtimeContext","options","blockingList","run","lowLevelEvaluate","Promise","all","evaluate","arguments","length","undefined","isAsync","passByRuntimeContext","menuUsage","usedArgs","Set","hasAppUsage","precooked","withParent","beforeVisitGlobal","node","parent","message","errorConstructor","hasNonStaticUsage","Error","globalVariables","attemptToVisitGlobals","lazy","Object","keys","usedCtx","usedProcessors","usedStates","tplStateStore","strict","usedFormStates","formStateStore","devHook","push","ctxStore","waitFor","usedTpls","tpl","add","attemptToCheckPermissions","usedFunctions","pendingPermissionsPreCheck","size","menu","usedMenuIds","map","menuId","fetchMenuById","getStoryboardByAppId","_hooks$checkInstalled","checkInstalledApps","waitForCheckingApps","_hooks$menu","_hooks$images","app","currentApp","location","query","match","flags","sys","data","event","overrideApp","variableName","hash","substring","getMenu","getMenuById","get","_target","key","getValue","ownKeys","Array","from","property","console","getItem","getMiscSettings","URLSearchParams","params","pathname","pkg","_t","k","processor","namespace","split","fromEntries","getAll","images","widgetImagesFactory","assign","appendI18nNamespace","result","expression","source","detail","context"],"sources":["../../../../src/internal/compute/evaluate.ts"],"sourcesContent":["import {\n cook,\n preevaluate,\n PreevaluateResult,\n shouldAllowRecursiveEvaluations,\n} from \"@next-core/cook\";\nimport { loadProcessorsImperatively } from \"@next-core/loader\";\nimport { supply } from \"@next-core/supply\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport {\n strictCollectMemberUsage,\n collectAppGetMenuUsage,\n collectInstalledAppsHasUsage,\n MemberCallUsage,\n} from \"@next-core/utils/storyboard\";\nimport { cloneDeep, omit } from \"lodash\";\nimport type { RuntimeContext } from \"../interfaces.js\";\nimport { customProcessors } from \"../../CustomProcessors.js\";\nimport {\n checkPermissionsUsage,\n storyboardFunctions,\n} from \"./StoryboardFunctions.js\";\nimport { getGeneralGlobals } from \"./getGeneralGlobals.js\";\nimport {\n getDynamicReadOnlyProxy,\n getReadOnlyProxy,\n} from \"../proxyFactories.js\";\nimport { devtoolsHookEmit, getDevHook } from \"../devtools.js\";\nimport { getMedia } from \"../mediaQuery.js\";\nimport { getStorageItem } from \"./getStorageItem.js\";\nimport {\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n getRuntime,\n hooks,\n} from \"../Runtime.js\";\nimport type { DataStore } from \"../data/DataStore.js\";\nimport { getTplStateStore } from \"../CustomTemplates/utils.js\";\nimport { widgetFunctions } from \"./WidgetFunctions.js\";\nimport { widgetI18nFactory } from \"./WidgetI18n.js\";\nimport { hasInstalledApp } from \"../hasInstalledApp.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../../isStrictMode.js\";\nimport { getFormStateStore } from \"../FormRenderer/utils.js\";\nimport { resolveData } from \"../data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./computeRealValue.js\";\n\nconst symbolForRaw = Symbol.for(\"pre.evaluated.raw\");\nconst symbolForContext = Symbol.for(\"pre.evaluated.context\");\n\nexport interface PreEvaluated {\n [symbolForRaw]: string;\n [symbolForContext]: RuntimeContext;\n}\n\nexport interface EvaluateOptions {\n lazy?: boolean;\n evaluationId?: number;\n}\n\nexport function isPreEvaluated(raw: unknown): raw is PreEvaluated {\n return !!(raw as PreEvaluated)?.[symbolForRaw];\n}\n\nexport function getPreEvaluatedRaw(pre: PreEvaluated): string {\n return pre[symbolForRaw];\n}\n\nexport function shouldDismissMarkingComputed(\n raw: string | PreEvaluated\n): boolean {\n if (typeof raw === \"string\") {\n return shouldAllowRecursiveEvaluations(raw);\n }\n return shouldAllowRecursiveEvaluations(raw[symbolForRaw]);\n}\n\nconst possibleErrorConstructs = new WeakSet<ErrorConstructor>([\n SyntaxError,\n TypeError,\n ReferenceError,\n]);\n\nexport function getCookErrorConstructor(error: any): ErrorConstructor {\n return possibleErrorConstructs.has(error.constructor)\n ? error.constructor\n : TypeError;\n}\n\nexport async function asyncEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { blockingList, run } = lowLevelEvaluate(\n raw,\n runtimeContext,\n options,\n true\n );\n await Promise.all(blockingList);\n return run();\n}\n\nexport function evaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { run } = lowLevelEvaluate(raw, runtimeContext, options, false);\n return run();\n}\n\nfunction lowLevelEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options: EvaluateOptions = {},\n isAsync?: boolean\n): {\n blockingList: (Promise<unknown> | undefined)[];\n run: Function;\n} {\n const blockingList: (Promise<unknown> | undefined)[] = [];\n if (typeof raw !== \"string\") {\n // If the `raw` is not a string, it must be a pre-evaluated object.\n // Then fulfil the context, and restore the original `raw`.\n\n const passByRuntimeContext = omit(runtimeContext, [\n \"pendingPermissionsPreCheck\",\n \"tplStateStoreMap\",\n \"tplStateStoreScope\",\n \"formStateStoreMap\",\n \"formStateStoreScope\",\n ]);\n\n runtimeContext = {\n ...raw[symbolForContext],\n ...passByRuntimeContext,\n };\n raw = raw[symbolForRaw];\n }\n\n // Collect `APP.getMenu(...)` usage before evaluating.\n const menuUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n const hasAppUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n\n // A `SyntaxError` maybe thrown.\n let precooked: PreevaluateResult;\n try {\n precooked = preevaluate(raw, {\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n collectAppGetMenuUsage(menuUsage, node, parent!);\n collectInstalledAppsHasUsage(hasAppUsage, node, parent!);\n },\n },\n });\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n\n if (menuUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"APP.getMenu\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n if (hasAppUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"INSTALLED_APPS.has\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n const globalVariables: Record<string, unknown> = {};\n const { attemptToVisitGlobals } = precooked;\n\n // Ignore evaluating if required `event/DATA` is missing in\n // context. Since they are are provided in different context, whenever\n // missing one of them, memorize the current context for later consuming.\n if (\n options.lazy ||\n (attemptToVisitGlobals.has(\"EVENT\") &&\n !hasOwnProperty(runtimeContext, \"event\")) ||\n (attemptToVisitGlobals.has(\"DATA\") &&\n !hasOwnProperty(runtimeContext, \"data\"))\n ) {\n return {\n blockingList,\n run() {\n return Object.keys(runtimeContext).length > 0\n ? ({\n [symbolForRaw]: raw,\n [symbolForContext]: runtimeContext,\n } as PreEvaluated)\n : raw;\n },\n };\n }\n\n let usedCtx: Set<string>;\n let usedProcessors: Set<string>;\n let usedStates: Set<string>;\n let tplStateStore: DataStore<\"STATE\"> | undefined;\n const strict = isStrictMode(runtimeContext);\n\n // For existed TPL usage, treat it as a STATE.\n if (\n attemptToVisitGlobals.has(\"STATE\") ||\n (!strict && attemptToVisitGlobals.has(\"TPL\"))\n ) {\n tplStateStore = getTplStateStore(runtimeContext, \"STATE\", `: \"${raw}\"`);\n }\n\n let usedFormStates: Set<string>;\n let formStateStore: DataStore<\"FORM_STATE\"> | undefined;\n if (attemptToVisitGlobals.has(\"FORM_STATE\")) {\n formStateStore = getFormStateStore(\n runtimeContext,\n \"FORM_STATE\",\n `: \"${raw}\"`\n );\n }\n\n const devHook = getDevHook();\n if (isAsync || devHook) {\n if (attemptToVisitGlobals.has(\"CTX\")) {\n usedCtx = strictCollectMemberUsage(raw, \"CTX\");\n isAsync && blockingList.push(runtimeContext.ctxStore.waitFor(usedCtx));\n }\n\n if (tplStateStore) {\n usedStates = strictCollectMemberUsage(raw, \"STATE\");\n // istanbul ignore if\n if (!strict) {\n const usedTpls = strictCollectMemberUsage(raw, \"TPL\");\n for (const tpl of usedTpls) {\n usedStates.add(tpl);\n }\n }\n isAsync && blockingList.push(tplStateStore.waitFor(usedStates));\n }\n\n if (formStateStore) {\n usedFormStates = strictCollectMemberUsage(raw, \"FORM_STATE\");\n isAsync && blockingList.push(formStateStore.waitFor(usedFormStates));\n }\n\n if (attemptToVisitGlobals.has(\"PROCESSORS\")) {\n usedProcessors = strictCollectMemberUsage(raw, \"PROCESSORS\", 2);\n isAsync &&\n blockingList.push(\n loadProcessorsImperatively(usedProcessors, getBrickPackages())\n );\n }\n }\n\n if (isAsync) {\n let attemptToCheckPermissions = attemptToVisitGlobals.has(\"PERMISSIONS\");\n // There maybe `PERMISSIONS.check()` usage in functions\n if (!attemptToCheckPermissions && attemptToVisitGlobals.has(\"FN\")) {\n const usedFunctions = [...strictCollectMemberUsage(raw, \"FN\")];\n attemptToCheckPermissions = checkPermissionsUsage(usedFunctions);\n }\n\n if (attemptToCheckPermissions) {\n blockingList.push(...runtimeContext.pendingPermissionsPreCheck);\n }\n\n if (menuUsage.usedArgs.size > 0 && hooks?.menu) {\n // Block evaluating if has `APP.getMenu(...)` usage.\n const usedMenuIds = [...menuUsage.usedArgs];\n blockingList.push(\n Promise.all(\n usedMenuIds.map((menuId) =>\n hooks!.menu!.fetchMenuById(menuId, runtimeContext, {\n getStoryboardByAppId: _internalApiGetStoryboardInBootstrapData,\n resolveData,\n asyncComputeRealValue,\n })\n )\n )\n );\n }\n\n if (hasAppUsage.usedArgs.size > 0) {\n // Only wait for specific apps\n blockingList.push(\n hooks?.checkInstalledApps?.waitForCheckingApps([\n ...hasAppUsage.usedArgs,\n ])\n );\n }\n }\n\n return {\n blockingList,\n run() {\n const {\n app: currentApp,\n location,\n query,\n match,\n flags,\n sys,\n ctxStore,\n data,\n event,\n } = runtimeContext;\n const app = runtimeContext.overrideApp ?? currentApp;\n\n for (const variableName of attemptToVisitGlobals) {\n switch (variableName) {\n // case \"ALIAS\":\n case \"ANCHOR\":\n globalVariables[variableName] = location.hash\n ? location.hash.substring(1)\n : null;\n break;\n case \"APP\":\n if (app == null) {\n throw new ReferenceError(`APP is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = {\n ...cloneDeep(app),\n getMenu: hooks?.menu?.getMenuById,\n };\n break;\n case \"CTX\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return ctxStore.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedCtx);\n },\n });\n break;\n case \"DATA\":\n globalVariables[variableName] = data;\n break;\n case \"EVENT\":\n globalVariables[variableName] = event;\n break;\n case \"FLAGS\":\n globalVariables[variableName] = getReadOnlyProxy(flags);\n break;\n case \"FORM_STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return formStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedFormStates);\n },\n });\n break;\n case \"HASH\":\n globalVariables[variableName] = location.hash;\n break;\n case \"INSTALLED_APPS\":\n globalVariables[variableName] = getReadOnlyProxy({\n has: hasInstalledApp,\n });\n break;\n case \"ITEM\":\n case \"INDEX\": {\n const property =\n variableName === \"ITEM\" ? \"forEachItem\" : \"forEachIndex\";\n if (!hasOwnProperty(runtimeContext, property)) {\n // eslint-disable-next-line no-console\n console.error(\n `Using \\`${variableName}\\` but no \\`:forEach\\` is found, check your expression: \"${raw}\"`\n );\n } else {\n globalVariables[variableName] = runtimeContext[property];\n }\n break;\n }\n case \"LOCAL_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"local\"),\n });\n break;\n case \"MEDIA\":\n globalVariables[variableName] = getReadOnlyProxy(getMedia());\n break;\n case \"MISC\":\n globalVariables[variableName] = getRuntime().getMiscSettings();\n break;\n case \"PARAMS\":\n if (query == null) {\n throw new ReferenceError(`PARAMS is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = new URLSearchParams(query);\n break;\n case \"PATH\":\n globalVariables[variableName] = getReadOnlyProxy(\n match?.params ?? {}\n );\n break;\n case \"PATH_NAME\":\n globalVariables[variableName] = location.pathname;\n break;\n case \"PROCESSORS\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n const pkg = customProcessors.get(key as string);\n if (!pkg) {\n throw new Error(\n `'PROCESSORS.${\n key as string\n }' is not registered! Have you installed the relevant brick package?`\n );\n }\n return getDynamicReadOnlyProxy({\n get(_t, k) {\n return pkg.get(k as string);\n },\n ownKeys() {\n return Array.from(pkg.keys());\n },\n });\n },\n ownKeys() {\n const keys = new Set<string>();\n for (const processor of usedProcessors) {\n const namespace = processor.split(\".\")[0];\n keys.add(namespace);\n }\n return Array.from(keys);\n },\n });\n break;\n case \"QUERY\":\n if (query == null) {\n throw new ReferenceError(`QUERY is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.get(key)])\n );\n break;\n case \"QUERY_ARRAY\":\n if (query == null) {\n throw new ReferenceError(\n `QUERY_ARRAY is not defined, in \"${raw}\"`\n );\n }\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.getAll(key)])\n );\n // case \"SEGUE\":\n break;\n case \"SESSION_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"session\"),\n });\n break;\n // istanbul ignore next\n case \"TPL\":\n warnAboutStrictMode(\n strict,\n 'Using \"TPL\" in expression',\n `check your expression: \"${raw}\"`\n );\n if (strict) {\n break;\n }\n // eslint-disable-next-line no-fallthrough\n case \"STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return tplStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedStates);\n },\n });\n break;\n case \"SYS\":\n globalVariables[variableName] = getReadOnlyProxy(sys ?? {});\n break;\n case \"__WIDGET_FN__\":\n globalVariables[variableName] = widgetFunctions;\n break;\n case \"__WIDGET_IMG__\":\n globalVariables[variableName] = hooks?.images?.widgetImagesFactory;\n break;\n case \"__WIDGET_I18N__\":\n globalVariables[variableName] = widgetI18nFactory;\n break;\n }\n }\n\n Object.assign(\n globalVariables,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n storyboardFunctions,\n app: app,\n appendI18nNamespace: runtimeContext.appendI18nNamespace,\n })\n );\n\n try {\n const result = cook(precooked.expression, precooked.source, {\n globalVariables: supply(\n precooked.attemptToVisitGlobals,\n globalVariables\n ),\n });\n const detail = { raw, context: globalVariables, result };\n devtoolsHookEmit(\"evaluation\", detail);\n return result;\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n },\n };\n}\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M,CAAC;QACtC,OAAOH,MAAM;MACf,CAAC,CAAC,OAAOzG,KAAU,EAAE;QACnB,MAAM0B,OAAO,GAAG,GAAG1B,KAAK,CAAC0B,OAAO,SAASpC,GAAG,GAAG;QAC/C,MAAMqC,gBAAgB,GAAG5B,uBAAuB,CAACC,KAAK,CAAC;QACvD,MAAM,IAAI2B,gBAAgB,CAACD,OAAO,CAAC;MACrC;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"evaluate.js","names":["cook","preevaluate","shouldAllowRecursiveEvaluations","loadProcessorsImperatively","supply","hasOwnProperty","strictCollectMemberUsage","collectAppGetMenuUsage","collectInstalledAppsHasUsage","cloneDeep","omit","customProcessors","checkPermissionsUsage","storyboardFunctions","getGeneralGlobals","getDynamicReadOnlyProxy","getReadOnlyProxy","devtoolsHookEmit","getDevHook","getMedia","getStorageItem","_internalApiGetStoryboardInBootstrapData","getBrickPackages","getRuntime","hooks","getTplStateStore","widgetFunctions","widgetI18nFactory","hasInstalledApp","isStrictMode","warnAboutStrictMode","getFormStateStore","resolveData","asyncComputeRealValue","symbolForRaw","Symbol","for","symbolForContext","isPreEvaluated","raw","getPreEvaluatedRaw","pre","shouldDismissMarkingComputed","possibleErrorConstructs","WeakSet","SyntaxError","TypeError","ReferenceError","getCookErrorConstructor","error","has","constructor","asyncEvaluate","runtimeContext","options","blockingList","run","lowLevelEvaluate","Promise","all","evaluate","arguments","length","undefined","isAsync","passByRuntimeContext","menuUsage","usedArgs","Set","hasAppUsage","precooked","withParent","beforeVisitGlobal","node","parent","message","errorConstructor","hasNonStaticUsage","Error","globalVariables","attemptToVisitGlobals","lazy","Object","keys","usedCtx","usedProcessors","usedStates","tplStateStore","strict","usedFormStates","formStateStore","devHook","push","ctxStore","waitFor","usedTpls","tpl","add","attemptToCheckPermissions","usedFunctions","pendingPermissionsPreCheck","size","menu","usedMenuIds","map","menuId","fetchMenuById","getStoryboardByAppId","_hooks$checkInstalled","checkInstalledApps","waitForCheckingApps","_hooks$menu","_hooks$images","app","currentApp","location","query","match","flags","sys","data","event","overrideApp","variableName","hash","substring","getMenu","getMenuById","get","_target","key","getValue","ownKeys","Array","from","property","console","getItem","getMiscSettings","URLSearchParams","params","pathname","pkg","_t","k","processor","namespace","split","fromEntries","getAll","images","widgetImagesFactory","assign","appendI18nNamespace","result","expression","source","detail","context"],"sources":["../../../../src/internal/compute/evaluate.ts"],"sourcesContent":["import {\n cook,\n preevaluate,\n PreevaluateResult,\n shouldAllowRecursiveEvaluations,\n} from \"@next-core/cook\";\nimport { loadProcessorsImperatively } from \"@next-core/loader\";\nimport { supply } from \"@next-core/supply\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport {\n strictCollectMemberUsage,\n collectAppGetMenuUsage,\n collectInstalledAppsHasUsage,\n MemberCallUsage,\n} from \"@next-core/utils/storyboard\";\nimport { cloneDeep, omit } from \"lodash\";\nimport type { RuntimeContext } from \"../interfaces.js\";\nimport { customProcessors } from \"../../CustomProcessors.js\";\nimport {\n checkPermissionsUsage,\n storyboardFunctions,\n} from \"./StoryboardFunctions.js\";\nimport { getGeneralGlobals } from \"./getGeneralGlobals.js\";\nimport {\n getDynamicReadOnlyProxy,\n getReadOnlyProxy,\n} from \"../proxyFactories.js\";\nimport { devtoolsHookEmit, getDevHook } from \"../devtools.js\";\nimport { getMedia } from \"../mediaQuery.js\";\nimport { getStorageItem } from \"./getStorageItem.js\";\nimport {\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n getRuntime,\n hooks,\n} from \"../Runtime.js\";\nimport type { DataStore } from \"../data/DataStore.js\";\nimport { getTplStateStore } from \"../CustomTemplates/utils.js\";\nimport { widgetFunctions } from \"./WidgetFunctions.js\";\nimport { widgetI18nFactory } from \"./WidgetI18n.js\";\nimport { hasInstalledApp } from \"../hasInstalledApp.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../../isStrictMode.js\";\nimport { getFormStateStore } from \"../FormRenderer/utils.js\";\nimport { resolveData } from \"../data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./computeRealValue.js\";\n\nconst symbolForRaw = Symbol.for(\"pre.evaluated.raw\");\nconst symbolForContext = Symbol.for(\"pre.evaluated.context\");\n\nexport interface PreEvaluated {\n [symbolForRaw]: string;\n [symbolForContext]: RuntimeContext;\n}\n\nexport interface EvaluateOptions {\n lazy?: boolean;\n evaluationId?: number;\n}\n\nexport function isPreEvaluated(raw: unknown): raw is PreEvaluated {\n return !!(raw as PreEvaluated)?.[symbolForRaw];\n}\n\nexport function getPreEvaluatedRaw(pre: PreEvaluated): string {\n return pre[symbolForRaw];\n}\n\nexport function shouldDismissMarkingComputed(\n raw: string | PreEvaluated\n): boolean {\n if (typeof raw === \"string\") {\n return shouldAllowRecursiveEvaluations(raw);\n }\n return shouldAllowRecursiveEvaluations(raw[symbolForRaw]);\n}\n\nconst possibleErrorConstructs = new WeakSet<ErrorConstructor>([\n SyntaxError,\n TypeError,\n ReferenceError,\n]);\n\nexport function getCookErrorConstructor(error: any): ErrorConstructor {\n return possibleErrorConstructs.has(error.constructor)\n ? error.constructor\n : TypeError;\n}\n\nexport async function asyncEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { blockingList, run } = lowLevelEvaluate(\n raw,\n runtimeContext,\n options,\n true\n );\n await Promise.all(blockingList);\n return run();\n}\n\nexport function evaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { run } = lowLevelEvaluate(raw, runtimeContext, options, false);\n return run();\n}\n\nfunction lowLevelEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options: EvaluateOptions = {},\n isAsync?: boolean\n): {\n blockingList: (Promise<unknown> | undefined)[];\n run: Function;\n} {\n const blockingList: (Promise<unknown> | undefined)[] = [];\n if (typeof raw !== \"string\") {\n // If the `raw` is not a string, it must be a pre-evaluated object.\n // Then fulfil the context, and restore the original `raw`.\n\n const passByRuntimeContext = omit(runtimeContext, [\n \"pendingPermissionsPreCheck\",\n \"tplStateStoreMap\",\n \"tplStateStoreScope\",\n \"formStateStoreMap\",\n \"formStateStoreScope\",\n ]);\n\n runtimeContext = {\n ...raw[symbolForContext],\n ...passByRuntimeContext,\n };\n raw = raw[symbolForRaw];\n }\n\n // Collect `APP.getMenu(...)` usage before evaluating.\n const menuUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n const hasAppUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n\n // A `SyntaxError` maybe thrown.\n let precooked: PreevaluateResult;\n try {\n precooked = preevaluate(raw, {\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n collectAppGetMenuUsage(menuUsage, node, parent!);\n collectInstalledAppsHasUsage(hasAppUsage, node, parent!);\n },\n },\n });\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n\n if (menuUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"APP.getMenu\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n if (hasAppUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"INSTALLED_APPS.has\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n const globalVariables: Record<string, unknown> = {};\n const { attemptToVisitGlobals } = precooked;\n\n // Ignore evaluating if required `event/DATA` is missing in\n // context. Since they are are provided in different context, whenever\n // missing one of them, memorize the current context for later consuming.\n if (\n options.lazy ||\n (attemptToVisitGlobals.has(\"EVENT\") &&\n !hasOwnProperty(runtimeContext, \"event\")) ||\n (attemptToVisitGlobals.has(\"DATA\") &&\n !hasOwnProperty(runtimeContext, \"data\"))\n ) {\n return {\n blockingList,\n run() {\n return Object.keys(runtimeContext).length > 0\n ? ({\n [symbolForRaw]: raw,\n [symbolForContext]: runtimeContext,\n } as PreEvaluated)\n : raw;\n },\n };\n }\n\n let usedCtx: Set<string>;\n let usedProcessors: Set<string>;\n let usedStates: Set<string>;\n let tplStateStore: DataStore<\"STATE\"> | undefined;\n const strict = isStrictMode(runtimeContext);\n\n // For existed TPL usage, treat it as a STATE.\n if (\n attemptToVisitGlobals.has(\"STATE\") ||\n (!strict && attemptToVisitGlobals.has(\"TPL\"))\n ) {\n tplStateStore = getTplStateStore(runtimeContext, \"STATE\", `: \"${raw}\"`);\n }\n\n let usedFormStates: Set<string>;\n let formStateStore: DataStore<\"FORM_STATE\"> | undefined;\n if (attemptToVisitGlobals.has(\"FORM_STATE\")) {\n formStateStore = getFormStateStore(\n runtimeContext,\n \"FORM_STATE\",\n `: \"${raw}\"`\n );\n }\n\n const devHook = getDevHook();\n if (isAsync || devHook) {\n if (attemptToVisitGlobals.has(\"CTX\")) {\n usedCtx = strictCollectMemberUsage(raw, \"CTX\");\n isAsync && blockingList.push(runtimeContext.ctxStore.waitFor(usedCtx));\n }\n\n if (tplStateStore) {\n usedStates = strictCollectMemberUsage(raw, \"STATE\");\n // istanbul ignore if\n if (!strict) {\n const usedTpls = strictCollectMemberUsage(raw, \"TPL\");\n for (const tpl of usedTpls) {\n usedStates.add(tpl);\n }\n }\n isAsync && blockingList.push(tplStateStore.waitFor(usedStates));\n }\n\n if (formStateStore) {\n usedFormStates = strictCollectMemberUsage(raw, \"FORM_STATE\");\n isAsync && blockingList.push(formStateStore.waitFor(usedFormStates));\n }\n\n if (attemptToVisitGlobals.has(\"PROCESSORS\")) {\n usedProcessors = strictCollectMemberUsage(raw, \"PROCESSORS\", 2);\n isAsync &&\n blockingList.push(\n loadProcessorsImperatively(usedProcessors, getBrickPackages())\n );\n }\n }\n\n if (isAsync) {\n let attemptToCheckPermissions = attemptToVisitGlobals.has(\"PERMISSIONS\");\n // There maybe `PERMISSIONS.check()` usage in functions\n if (!attemptToCheckPermissions && attemptToVisitGlobals.has(\"FN\")) {\n const usedFunctions = [...strictCollectMemberUsage(raw, \"FN\")];\n attemptToCheckPermissions = checkPermissionsUsage(usedFunctions);\n }\n\n if (attemptToCheckPermissions) {\n blockingList.push(...runtimeContext.pendingPermissionsPreCheck);\n }\n\n if (menuUsage.usedArgs.size > 0 && hooks?.menu) {\n // Block evaluating if has `APP.getMenu(...)` usage.\n const usedMenuIds = [...menuUsage.usedArgs];\n blockingList.push(\n Promise.all(\n usedMenuIds.map((menuId) =>\n hooks!.menu!.fetchMenuById(menuId, runtimeContext, {\n getStoryboardByAppId: _internalApiGetStoryboardInBootstrapData,\n resolveData,\n asyncComputeRealValue,\n })\n )\n )\n );\n }\n\n if (hasAppUsage.usedArgs.size > 0) {\n // Only wait for specific apps\n blockingList.push(\n hooks?.checkInstalledApps?.waitForCheckingApps([\n ...hasAppUsage.usedArgs,\n ])\n );\n }\n }\n\n return {\n blockingList,\n run() {\n const {\n app: currentApp,\n location,\n query,\n match,\n flags,\n sys,\n ctxStore,\n data,\n event,\n } = runtimeContext;\n const app = runtimeContext.overrideApp ?? currentApp;\n\n for (const variableName of attemptToVisitGlobals) {\n switch (variableName) {\n // case \"ALIAS\":\n case \"ANCHOR\":\n globalVariables[variableName] = location.hash\n ? location.hash.substring(1)\n : null;\n break;\n case \"APP\":\n if (app == null) {\n throw new ReferenceError(`APP is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = {\n ...cloneDeep(app),\n getMenu: hooks?.menu?.getMenuById,\n };\n break;\n case \"CTX\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return ctxStore.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedCtx);\n },\n });\n break;\n case \"DATA\":\n globalVariables[variableName] = data;\n break;\n case \"EVENT\":\n globalVariables[variableName] = event;\n break;\n case \"FLAGS\":\n globalVariables[variableName] = getReadOnlyProxy(flags);\n break;\n case \"FORM_STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return formStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedFormStates);\n },\n });\n break;\n case \"HASH\":\n globalVariables[variableName] = location.hash;\n break;\n case \"INSTALLED_APPS\":\n globalVariables[variableName] = getReadOnlyProxy({\n has: hasInstalledApp,\n });\n break;\n case \"ITEM\":\n case \"INDEX\":\n case \"SIZE\": {\n const property =\n variableName === \"ITEM\"\n ? \"forEachItem\"\n : variableName === \"INDEX\"\n ? \"forEachIndex\"\n : \"forEachSize\";\n if (!hasOwnProperty(runtimeContext, property)) {\n // eslint-disable-next-line no-console\n console.error(\n `Using \\`${variableName}\\` but no \\`:forEach\\` is found, check your expression: \"${raw}\"`\n );\n } else {\n globalVariables[variableName] = runtimeContext[property];\n }\n break;\n }\n case \"LOCAL_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"local\"),\n });\n break;\n case \"MEDIA\":\n globalVariables[variableName] = getReadOnlyProxy(getMedia());\n break;\n case \"MISC\":\n globalVariables[variableName] = getRuntime().getMiscSettings();\n break;\n case \"PARAMS\":\n if (query == null) {\n throw new ReferenceError(`PARAMS is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = new URLSearchParams(query);\n break;\n case \"PATH\":\n globalVariables[variableName] = getReadOnlyProxy(\n match?.params ?? {}\n );\n break;\n case \"PATH_NAME\":\n globalVariables[variableName] = location.pathname;\n break;\n case \"PROCESSORS\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n const pkg = customProcessors.get(key as string);\n if (!pkg) {\n throw new Error(\n `'PROCESSORS.${\n key as string\n }' is not registered! Have you installed the relevant brick package?`\n );\n }\n return getDynamicReadOnlyProxy({\n get(_t, k) {\n return pkg.get(k as string);\n },\n ownKeys() {\n return Array.from(pkg.keys());\n },\n });\n },\n ownKeys() {\n const keys = new Set<string>();\n for (const processor of usedProcessors) {\n const namespace = processor.split(\".\")[0];\n keys.add(namespace);\n }\n return Array.from(keys);\n },\n });\n break;\n case \"QUERY\":\n if (query == null) {\n throw new ReferenceError(`QUERY is not defined, in \"${raw}\"`);\n }\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.get(key)])\n );\n break;\n case \"QUERY_ARRAY\":\n if (query == null) {\n throw new ReferenceError(\n `QUERY_ARRAY is not defined, in \"${raw}\"`\n );\n }\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.getAll(key)])\n );\n // case \"SEGUE\":\n break;\n case \"SESSION_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"session\"),\n });\n break;\n // istanbul ignore next\n case \"TPL\":\n warnAboutStrictMode(\n strict,\n 'Using \"TPL\" in expression',\n `check your expression: \"${raw}\"`\n );\n if (strict) {\n break;\n }\n // eslint-disable-next-line no-fallthrough\n case \"STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(_target, key) {\n return tplStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedStates);\n },\n });\n break;\n case \"SYS\":\n globalVariables[variableName] = getReadOnlyProxy(sys ?? {});\n break;\n case \"__WIDGET_FN__\":\n globalVariables[variableName] = widgetFunctions;\n break;\n case \"__WIDGET_IMG__\":\n globalVariables[variableName] = hooks?.images?.widgetImagesFactory;\n break;\n case \"__WIDGET_I18N__\":\n globalVariables[variableName] = widgetI18nFactory;\n break;\n }\n }\n\n Object.assign(\n globalVariables,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n storyboardFunctions,\n app: app,\n appendI18nNamespace: runtimeContext.appendI18nNamespace,\n })\n );\n\n try {\n const result = cook(precooked.expression, precooked.source, {\n globalVariables: supply(\n precooked.attemptToVisitGlobals,\n globalVariables\n ),\n });\n const detail = { raw, context: globalVariables, result };\n devtoolsHookEmit(\"evaluation\", detail);\n return result;\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n },\n };\n}\n"],"mappings":"AAAA,SACEA,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gB,CAAC,YAAY,EAAE4I,MAAM,CAAC;QACtC,OAAOH,MAAM;MACf,CAAC,CAAC,OAAOzG,KAAU,EAAE;QACnB,MAAM0B,OAAO,GAAG,GAAG1B,KAAK,CAAC0B,OAAO,SAASpC,GAAG,GAAG;QAC/C,MAAMqC,gBAAgB,GAAG5B,uBAAuB,CAACC,KAAK,CAAC;QACvD,MAAM,IAAI2B,gBAAgB,CAACD,OAAO,CAAC;MACrC;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n MicroApp,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n __temporary_tpl_tag_name?: string;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n routeId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n\nexport interface RuntimeDataVale\n extends Pick<LegacyCompatibleRuntimeContext, \"match\" | \"sys\" | \"query\"> {\n location: {\n href: string;\n origin: string;\n hostname: string;\n host: string;\n };\n app?: MicroApp;\n}\n\nexport interface RuntimeDataValueOption {\n routeId?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n Storyboard,\n StaticMenuConf,\n UseProviderResolveConf,\n MicroApp,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n forEachSize?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n __temporary_tpl_tag_name?: string;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n routeId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n collectUsedContracts?(storyboard: Storyboard): string[] | Promise<string[]>;\n}\n\nexport interface MenuRequestNode {\n child?: MenuRequestNode;\n sibling?: MenuRequestNode;\n return?: MenuRequestNode;\n request?: Promise<StaticMenuConf>;\n}\n\nexport interface DebugDataValue {\n resolve?: UseProviderResolveConf;\n value?: unknown;\n}\n\nexport interface RuntimeDataVale\n extends Pick<LegacyCompatibleRuntimeContext, \"match\" | \"sys\" | \"query\"> {\n location: {\n href: string;\n origin: string;\n hostname: string;\n host: string;\n };\n app?: MicroApp;\n}\n\nexport interface RuntimeDataValueOption {\n routeId?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ export declare const symbolForAsyncComputedPropsFromHost: unique symbol;
|
|
|
4
4
|
export declare const symbolForTplStateStoreId: unique symbol;
|
|
5
5
|
export declare const symbolForTPlExternalForEachItem: unique symbol;
|
|
6
6
|
export declare const symbolForTPlExternalForEachIndex: unique symbol;
|
|
7
|
+
export declare const symbolForTPlExternalForEachSize: unique symbol;
|
|
7
8
|
export declare const symbolForTPlExternalNoForEach: unique symbol;
|
|
8
9
|
export type RuntimeBrickConfWithTplSymbols = BrickConf & RuntimeBrickConfOfTplSymbols;
|
|
9
10
|
export interface RuntimeBrickConfOfTplSymbols {
|
|
@@ -11,5 +12,6 @@ export interface RuntimeBrickConfOfTplSymbols {
|
|
|
11
12
|
[symbolForTplStateStoreId]?: string;
|
|
12
13
|
[symbolForTPlExternalForEachItem]?: unknown;
|
|
13
14
|
[symbolForTPlExternalForEachIndex]?: number;
|
|
15
|
+
[symbolForTPlExternalForEachSize]?: number;
|
|
14
16
|
[symbolForTPlExternalNoForEach]?: boolean;
|
|
15
17
|
}
|
|
@@ -12,6 +12,7 @@ export interface RuntimeContext extends LegacyCompatibleRuntimeContext {
|
|
|
12
12
|
tplStateStoreScope?: DataStore<"STATE">[];
|
|
13
13
|
forEachItem?: unknown;
|
|
14
14
|
forEachIndex?: number;
|
|
15
|
+
forEachSize?: number;
|
|
15
16
|
appendI18nNamespace?: string;
|
|
16
17
|
formStateStoreMap: Map<string, DataStore<"FORM_STATE">>;
|
|
17
18
|
formStateStoreId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.0",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@next-core/color-theme": "^0.4.8",
|
|
48
|
-
"@next-core/cook": "^2.4.
|
|
49
|
-
"@next-core/http": "^1.2.
|
|
50
|
-
"@next-core/i18n": "^1.0.
|
|
51
|
-
"@next-core/inject": "^1.0.
|
|
52
|
-
"@next-core/loader": "^1.6.
|
|
53
|
-
"@next-core/supply": "^2.1.
|
|
48
|
+
"@next-core/cook": "^2.4.7",
|
|
49
|
+
"@next-core/http": "^1.2.6",
|
|
50
|
+
"@next-core/i18n": "^1.0.58",
|
|
51
|
+
"@next-core/inject": "^1.0.39",
|
|
52
|
+
"@next-core/loader": "^1.6.5",
|
|
53
|
+
"@next-core/supply": "^2.1.20",
|
|
54
54
|
"@next-core/types": "^1.11.2",
|
|
55
|
-
"@next-core/utils": "^1.7.
|
|
55
|
+
"@next-core/utils": "^1.7.16",
|
|
56
56
|
"@ungap/event-target": "^0.2.4",
|
|
57
57
|
"compare-versions": "^6.1.0",
|
|
58
58
|
"history": "^4.10.1",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@next-api-sdk/api-gateway-sdk": "^1.1.0",
|
|
66
66
|
"@next-api-sdk/micro-app-sdk": "^1.2.1",
|
|
67
67
|
"@next-core/build-next-libs": "^1.0.18",
|
|
68
|
-
"@next-core/test-next": "^1.1.
|
|
68
|
+
"@next-core/test-next": "^1.1.5"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e3fcc4d2780cfa67576a8dcd834917856f8a1a51"
|
|
71
71
|
}
|