@next-core/runtime 1.47.0 → 1.49.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/StoryboardFunctionRegistry.js +34 -9
- package/dist/cjs/StoryboardFunctionRegistry.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +4 -0
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/Router.js +2 -0
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/routeMatchedMap.js +19 -0
- package/dist/cjs/internal/routeMatchedMap.js.map +1 -0
- package/dist/cjs/internal/secret_internals.js +15 -2
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/StoryboardFunctionRegistry.js +34 -9
- package/dist/esm/StoryboardFunctionRegistry.js.map +1 -1
- package/dist/esm/internal/Renderer.js +4 -0
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/Router.js +2 -0
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/routeMatchedMap.js +11 -0
- package/dist/esm/internal/routeMatchedMap.js.map +1 -0
- package/dist/esm/internal/secret_internals.js +14 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/StoryboardFunctionRegistry.d.ts +13 -2
- package/dist/types/internal/interfaces.d.ts +14 -1
- package/dist/types/internal/routeMatchedMap.d.ts +6 -0
- package/dist/types/internal/secret_internals.d.ts +3 -2
- package/package.json +5 -5
|
@@ -12,6 +12,7 @@ import { customTemplates } from "../CustomTemplates.js";
|
|
|
12
12
|
import { registerAppI18n } from "./registerAppI18n.js";
|
|
13
13
|
import { getTplStateStore } from "./CustomTemplates/utils.js";
|
|
14
14
|
import { loadBricksImperatively, loadEditorsImperatively } from "@next-core/loader";
|
|
15
|
+
import { getMatchedRoute } from "./routeMatchedMap.js";
|
|
15
16
|
export const symbolForRootRuntimeContext = Symbol.for("root.runtimeContext");
|
|
16
17
|
export async function renderUseBrick(useBrick, data, errorBoundary) {
|
|
17
18
|
var _output$node, _output$node2;
|
|
@@ -281,11 +282,13 @@ export async function getAddedContracts(storyboardPatch, _ref5) {
|
|
|
281
282
|
}
|
|
282
283
|
export async function debugDataValue(debugData, _ref6) {
|
|
283
284
|
let {
|
|
284
|
-
tplStateStoreId
|
|
285
|
+
tplStateStoreId,
|
|
286
|
+
routeId
|
|
285
287
|
} = _ref6;
|
|
286
288
|
const runtimeContext = {
|
|
287
289
|
..._internalApiGetRuntimeContext(),
|
|
288
|
-
tplStateStoreId
|
|
290
|
+
tplStateStoreId,
|
|
291
|
+
match: getMatchedRoute(routeId)
|
|
289
292
|
};
|
|
290
293
|
if (debugData.resolve) {
|
|
291
294
|
return resolveData(debugData.resolve, runtimeContext, {
|
|
@@ -294,5 +297,14 @@ export async function debugDataValue(debugData, _ref6) {
|
|
|
294
297
|
}
|
|
295
298
|
return asyncComputeRealValue(debugData.value, runtimeContext);
|
|
296
299
|
}
|
|
300
|
+
export function getLegalRuntimeValue(options) {
|
|
301
|
+
const runtimeContext = _internalApiGetRuntimeContext();
|
|
302
|
+
return {
|
|
303
|
+
app: (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.overrideApp) ?? (runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.app),
|
|
304
|
+
location: pick(location, ["href", "origin", "hostname", "host"]),
|
|
305
|
+
...pick(runtimeContext, ["query", "sys"]),
|
|
306
|
+
match: getMatchedRoute(options === null || options === void 0 ? void 0 : options.routeId)
|
|
307
|
+
};
|
|
308
|
+
}
|
|
297
309
|
export { setRealTimeDataInspectRoot, addRealTimeDataInspectHook } from "./data/realTimeDataInspect.js";
|
|
298
310
|
//# sourceMappingURL=secret_internals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","scopedStores","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push","debugDataValue","debugData","_ref6","resolve","cache","value","setRealTimeDataInspectRoot","addRealTimeDataInspectHook"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport {\n loadBricksImperatively,\n loadEditorsImperatively,\n} from \"@next-core/loader\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown,\n errorBoundary?: boolean\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function loadEditors(editors: string[] | Set<string>) {\n return loadEditorsImperatively(editors, getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":"AASA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAEtD,SAASC,WAAW,QAAQ,uBAAuB;AACnD,SAASC,qBAAqB,QAAQ,+BAA+B;AASrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,mBAAmB;AAI1B,OAAO,MAAMC,2BAA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B,+BAA+B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","resolveData","asyncComputeRealValue","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","getTplStateStore","loadBricksImperatively","loadEditorsImperatively","getMatchedRoute","symbolForRootRuntimeContext","Symbol","for","renderUseBrick","useBrick","data","errorBoundary","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","scopedStores","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","meta","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","loadBricks","loadEditors","editors","getRenderId","getAddedContracts","_ref5","updateStoryboardType","collectUsedContracts","updatedStoryboard","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push","debugDataValue","debugData","_ref6","routeId","resolve","cache","value","getLegalRuntimeValue","app","overrideApp","location","setRealTimeDataInspectRoot","addRealTimeDataInspectHook"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n RuntimeContext,\n DebugDataValue,\n RuntimeDataVale,\n RuntimeDataValueOption,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport {\n loadBricksImperatively,\n loadEditorsImperatively,\n} from \"@next-core/loader\";\nimport { getMatchedRoute } from \"./routeMatchedMap.js\";\n\nexport type { DataValueOption, RuntimeContext };\n\nexport const symbolForRootRuntimeContext = Symbol.for(\"root.runtimeContext\");\n\nexport interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {\n [symbolForRootRuntimeContext]?: RuntimeContext;\n}\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: RuntimeUseBrickConfWithRootSymbols,\n data: unknown,\n errorBoundary?: boolean\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ...(useBrick[symbolForRootRuntimeContext] ??\n _internalApiGetRuntimeContext()!),\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict && !errorBoundary\n ? useBrick\n : {\n errorBoundary,\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n [],\n {}\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n meta: {\n // Keep runtime fields such as `injectMenus`\n ...storyboard.meta,\n ...storyboardPatch.meta,\n },\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(\n settings,\n \"properties\",\n \"events\",\n \"lifeCycle\",\n \"context\",\n \"slots\",\n \"children\"\n ),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\n/**\n * Support loading v3 bricks only.\n */\nexport function loadBricks(bricks: string[]) {\n return loadBricksImperatively(bricks, getBrickPackages());\n}\n\nexport function loadEditors(editors: string[] | Set<string>) {\n return loadEditorsImperatively(editors, getBrickPackages());\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n { appId, updateStoryboardType, collectUsedContracts }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectUsedContracts) {\n const contractApis = await collectUsedContracts(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n\nexport async function debugDataValue(\n debugData: DebugDataValue,\n { tplStateStoreId, routeId }: DataValueOption\n): Promise<any> {\n const runtimeContext = {\n ..._internalApiGetRuntimeContext()!,\n tplStateStoreId,\n match: getMatchedRoute(routeId as string),\n };\n\n if (debugData.resolve) {\n return resolveData(debugData.resolve!, runtimeContext, { cache: \"reload\" });\n }\n\n return asyncComputeRealValue(debugData.value, runtimeContext);\n}\n\nexport function getLegalRuntimeValue(\n options?: RuntimeDataValueOption\n): RuntimeDataVale {\n const runtimeContext = _internalApiGetRuntimeContext();\n\n return {\n app: runtimeContext?.overrideApp ?? runtimeContext?.app,\n location: pick(location, [\"href\", \"origin\", \"hostname\", \"host\"]),\n ...pick(runtimeContext, [\"query\", \"sys\"]),\n match: getMatchedRoute(options?.routeId as string),\n } as RuntimeDataVale;\n}\n\nexport {\n setRealTimeDataInspectRoot,\n addRealTimeDataInspectHook,\n} from \"./data/realTimeDataInspect.js\";\n"],"mappings":"AASA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BA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streeNode } from "@next-core/cook";
|
|
2
|
+
import { cook, precookFunction, EstreeNode } from "@next-core/cook";
|
|
3
|
+
import { supply } from "@next-core/supply";
|
|
4
|
+
import type _ from "lodash";
|
|
3
5
|
/** @internal */
|
|
4
6
|
export type ReadonlyStoryboardFunctions = Readonly<Record<string, Function>>;
|
|
5
7
|
/** @internal */
|
|
@@ -37,8 +39,17 @@ export interface FunctionCoverageSettings {
|
|
|
37
39
|
/** @internal */
|
|
38
40
|
export type PartialMicroApp = Pick<MicroApp, "id" | "isBuildPush">;
|
|
39
41
|
/** @internal */
|
|
40
|
-
export declare function StoryboardFunctionRegistryFactory({ widgetId, widgetVersion, collectCoverage, }?: {
|
|
42
|
+
export declare function StoryboardFunctionRegistryFactory({ widgetId, widgetVersion, collectCoverage, debuggerOverrides, }?: {
|
|
41
43
|
widgetId?: string;
|
|
42
44
|
widgetVersion?: string;
|
|
43
45
|
collectCoverage?: FunctionCoverageSettings;
|
|
46
|
+
debuggerOverrides?: (ctx: {
|
|
47
|
+
precookFunction: typeof precookFunction;
|
|
48
|
+
cook: typeof cook;
|
|
49
|
+
supply: typeof supply;
|
|
50
|
+
}) => {
|
|
51
|
+
LodashWithStaticFields?: Partial<typeof _>;
|
|
52
|
+
ArrayConstructor?: typeof Array;
|
|
53
|
+
ObjectWithStaticFields?: Partial<typeof Object>;
|
|
54
|
+
};
|
|
44
55
|
}): StoryboardFunctionRegistry;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LegacyCompatibleRuntimeContext } from "@next-core/inject";
|
|
2
|
-
import type { BrickEventHandler, BrickEventsMap, CustomTemplate, RouteConf, RuntimeSnippet, CustomTemplateProxy, CustomTemplateProxyBasicProperty, CustomTemplateProxySlot, SlotsConfOfBricks, Storyboard, StaticMenuConf, UseProviderResolveConf } from "@next-core/types";
|
|
2
|
+
import type { BrickEventHandler, BrickEventsMap, CustomTemplate, RouteConf, RuntimeSnippet, CustomTemplateProxy, CustomTemplateProxyBasicProperty, CustomTemplateProxySlot, SlotsConfOfBricks, Storyboard, StaticMenuConf, UseProviderResolveConf, MicroApp } from "@next-core/types";
|
|
3
3
|
import type { DataStore } from "./data/DataStore.js";
|
|
4
4
|
import { RenderTag } from "./enums.js";
|
|
5
5
|
import { RuntimeBrickConfWithTplSymbols } from "./CustomTemplates/constants.js";
|
|
@@ -110,6 +110,7 @@ interface ReversedSlotProxy {
|
|
|
110
110
|
export type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols & RuntimeBrickConfOfFormSymbols;
|
|
111
111
|
export interface DataValueOption {
|
|
112
112
|
tplStateStoreId?: string;
|
|
113
|
+
routeId?: string;
|
|
113
114
|
}
|
|
114
115
|
export type PreviewStoryboardPatch = CustomTemplate | RouteConf | RuntimeSnippet;
|
|
115
116
|
export interface PreviewOption {
|
|
@@ -128,4 +129,16 @@ export interface DebugDataValue {
|
|
|
128
129
|
resolve?: UseProviderResolveConf;
|
|
129
130
|
value?: unknown;
|
|
130
131
|
}
|
|
132
|
+
export interface RuntimeDataVale extends Pick<LegacyCompatibleRuntimeContext, "match" | "sys" | "query"> {
|
|
133
|
+
location: {
|
|
134
|
+
href: string;
|
|
135
|
+
origin: string;
|
|
136
|
+
hostname: string;
|
|
137
|
+
host: string;
|
|
138
|
+
};
|
|
139
|
+
app?: MicroApp;
|
|
140
|
+
}
|
|
141
|
+
export interface RuntimeDataValueOption {
|
|
142
|
+
routeId?: string;
|
|
143
|
+
}
|
|
131
144
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LegacyCompatibleRuntimeContext } from "@next-core/inject";
|
|
2
|
+
type RouteMatched = LegacyCompatibleRuntimeContext["match"];
|
|
3
|
+
export declare function setMatchedRoute(id: string, match: RouteMatched): void;
|
|
4
|
+
export declare function getMatchedRoute(id: string): RouteMatched;
|
|
5
|
+
export declare function clearMatchedRoutes(): void;
|
|
6
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BrickConf, CustomTemplate, RouteConf, Storyboard, UseSingleBrickConf, ContextConf } from "@next-core/types";
|
|
2
2
|
import { RendererContext } from "./RendererContext.js";
|
|
3
3
|
import type { DataStore } from "./data/DataStore.js";
|
|
4
|
-
import type { DataValueOption, PreviewOption, PreviewStoryboardPatch, RenderRoot, RuntimeContext, DebugDataValue } from "./interfaces.js";
|
|
4
|
+
import type { DataValueOption, PreviewOption, PreviewStoryboardPatch, RenderRoot, RuntimeContext, DebugDataValue, RuntimeDataVale, RuntimeDataValueOption } from "./interfaces.js";
|
|
5
5
|
export type { DataValueOption, RuntimeContext };
|
|
6
6
|
export declare const symbolForRootRuntimeContext: unique symbol;
|
|
7
7
|
export interface RuntimeUseBrickConfWithRootSymbols extends UseSingleBrickConf {
|
|
@@ -41,5 +41,6 @@ export declare function loadBricks(bricks: string[]): Promise<void>;
|
|
|
41
41
|
export declare function loadEditors(editors: string[] | Set<string>): Promise<void>;
|
|
42
42
|
export declare function getRenderId(): string | undefined;
|
|
43
43
|
export declare function getAddedContracts(storyboardPatch: PreviewStoryboardPatch, { appId, updateStoryboardType, collectUsedContracts }: PreviewOption): Promise<string[]>;
|
|
44
|
-
export declare function debugDataValue(debugData: DebugDataValue, { tplStateStoreId }: DataValueOption): Promise<any>;
|
|
44
|
+
export declare function debugDataValue(debugData: DebugDataValue, { tplStateStoreId, routeId }: DataValueOption): Promise<any>;
|
|
45
|
+
export declare function getLegalRuntimeValue(options?: RuntimeDataValueOption): RuntimeDataVale;
|
|
45
46
|
export { setRealTimeDataInspectRoot, addRealTimeDataInspectHook, } from "./data/realTimeDataInspect.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.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.
|
|
48
|
+
"@next-core/cook": "^2.4.0",
|
|
49
49
|
"@next-core/http": "^1.2.4",
|
|
50
|
-
"@next-core/i18n": "^1.0.
|
|
50
|
+
"@next-core/i18n": "^1.0.51",
|
|
51
51
|
"@next-core/inject": "^1.0.37",
|
|
52
52
|
"@next-core/loader": "^1.6.0",
|
|
53
53
|
"@next-core/supply": "^2.1.18",
|
|
54
54
|
"@next-core/types": "^1.11.1",
|
|
55
|
-
"@next-core/utils": "^1.7.
|
|
55
|
+
"@next-core/utils": "^1.7.9",
|
|
56
56
|
"@ungap/event-target": "^0.2.4",
|
|
57
57
|
"compare-versions": "^6.1.0",
|
|
58
58
|
"history": "^4.10.1",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@next-core/build-next-libs": "^1.0.17",
|
|
68
68
|
"@next-core/test-next": "^1.1.3"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "247675e519b0102b91ac691300eb4a85d082f0e5"
|
|
71
71
|
}
|