@next-core/runtime 1.49.5 → 1.49.7

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.
@@ -115,7 +115,7 @@ function StoryboardFunctionRegistryFactory({
115
115
  beforeCall: collector.beforeCall,
116
116
  beforeBranch: collector.beforeBranch
117
117
  },
118
- debug: true
118
+ debug: !!debuggerOverrides
119
119
  });
120
120
  fn.processed = true;
121
121
  return fn.cooked;
@@ -1 +1 @@
1
- {"version":3,"file":"StoryboardFunctionRegistry.js","names":["_cook","require","_supply","_storyboard","_getGeneralGlobals","StoryboardFunctionRegistryFactory","widgetId","widgetVersion","collectCoverage","debuggerOverrides","registeredFunctions","Map","overrides","precookFunction","cook","supply","storyboardFunctions","Proxy","Object","freeze","get","_target","key","getStoryboardFunction","currentApp","registerStoryboardFunctions","functions","app","clear","Array","isArray","fn","deps","collectMemberUsageInFunction","hasPermissionsCheck","has","set","name","source","typescript","undefined","processed","cooked","collector","createCollector","precooked","hooks","beforeVisit","globalVariables","attemptToVisitGlobals","getGeneralGlobals","isStoryboardFunction","function","rules","noVar","LodashWithStaticFields","_","ArrayConstructor","ObjectWithStaticFields","beforeEvaluate","beforeCall","beforeBranch","debug","updateStoryboardFunction","data","newFn","checkPermissionsUsage","functionNames","checkedFunctions","Set","add","some","clearGlobalExecutionContextStack","__dev_only_clearGlobalExecutionContextStack","getGlobalExecutionContextStack","__dev_only_getGlobalExecutionContextStack"],"sources":["../../src/StoryboardFunctionRegistry.ts"],"sourcesContent":["import type { MicroApp, StoryboardFunction } from \"@next-core/types\";\nimport {\n cook,\n precookFunction,\n EstreeNode,\n __dev_only_clearGlobalExecutionContextStack,\n __dev_only_getGlobalExecutionContextStack,\n} from \"@next-core/cook\";\nimport { supply } from \"@next-core/supply\";\nimport { collectMemberUsageInFunction } from \"@next-core/utils/storyboard\";\nimport type _ from \"lodash\";\nimport { getGeneralGlobals } from \"./internal/compute/getGeneralGlobals.js\";\n\n/** @internal */\nexport type ReadonlyStoryboardFunctions = Readonly<Record<string, Function>>;\n\n/** @internal */\nexport type StoryboardFunctionPatch = Pick<\n StoryboardFunction,\n \"source\" | \"typescript\"\n>;\n\n/** @internal */\nexport interface StoryboardFunctionRegistry {\n /** A readonly proxy for accessing cooked storyboard functions. */\n storyboardFunctions: ReadonlyStoryboardFunctions;\n\n /** Register storyboard functions. */\n registerStoryboardFunctions(\n functions: StoryboardFunction[] | undefined,\n app?: PartialMicroApp\n ): void;\n\n /** Update a storyboard function during debugging. */\n updateStoryboardFunction(name: string, data: StoryboardFunctionPatch): void;\n\n checkPermissionsUsage(functionNames: string[]): boolean;\n\n clearGlobalExecutionContextStack(): void;\n getGlobalExecutionContextStack(): ReturnType<\n typeof __dev_only_getGlobalExecutionContextStack\n >;\n}\n\n/** @internal */\nexport interface RuntimeStoryboardFunction {\n source: string;\n typescript?: boolean;\n processed?: boolean;\n cooked?: Function;\n deps: Set<string>;\n hasPermissionsCheck: boolean;\n}\n\n/** @internal */\nexport interface FunctionCoverageCollector {\n beforeVisit(node: EstreeNode): void;\n beforeEvaluate(node: EstreeNode): void;\n beforeCall(node: EstreeNode): void;\n beforeBranch(node: EstreeNode, branch: string): void;\n}\n\n/** @internal */\nexport interface FunctionCoverageSettings {\n createCollector(name: string): FunctionCoverageCollector;\n}\n\n/** @internal */\nexport type PartialMicroApp = Pick<MicroApp, \"id\" | \"isBuildPush\">;\n\n/** @internal */\nexport function StoryboardFunctionRegistryFactory({\n widgetId,\n widgetVersion,\n collectCoverage,\n debuggerOverrides,\n}: {\n widgetId?: string;\n widgetVersion?: string;\n collectCoverage?: FunctionCoverageSettings;\n debuggerOverrides?: (ctx: {\n precookFunction: typeof precookFunction;\n cook: typeof cook;\n supply: typeof supply;\n }) => {\n LodashWithStaticFields?: Partial<typeof _>;\n ArrayConstructor?: typeof Array;\n ObjectWithStaticFields?: Partial<typeof Object>;\n };\n} = {}): StoryboardFunctionRegistry {\n const registeredFunctions = new Map<string, RuntimeStoryboardFunction>();\n\n const overrides = debuggerOverrides?.({\n precookFunction,\n cook,\n supply,\n });\n\n // Use `Proxy` with a frozen target, to make a readonly function registry.\n const storyboardFunctions = new Proxy(Object.freeze({}), {\n get(_target, key) {\n return getStoryboardFunction(key as string);\n },\n }) as ReadonlyStoryboardFunctions;\n\n let currentApp: PartialMicroApp | undefined;\n\n function registerStoryboardFunctions(\n functions: StoryboardFunction[],\n app?: PartialMicroApp\n ): void {\n if (app) {\n currentApp = app;\n }\n registeredFunctions.clear();\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n const deps = collectMemberUsageInFunction(fn, \"FN\", !!collectCoverage);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n fn,\n \"PERMISSIONS\",\n !!collectCoverage\n ).has(\"check\");\n registeredFunctions.set(fn.name, {\n source: fn.source,\n typescript: fn.typescript,\n deps,\n hasPermissionsCheck,\n });\n }\n }\n }\n\n function getStoryboardFunction(name: string): Function | undefined {\n const fn = registeredFunctions.get(name);\n if (!fn) {\n return undefined;\n }\n if (fn.processed) {\n return fn.cooked;\n }\n let collector: FunctionCoverageCollector | undefined;\n if (collectCoverage) {\n collector = collectCoverage.createCollector(name);\n }\n const precooked = precookFunction(fn.source, {\n typescript: fn.typescript,\n hooks: collector && {\n beforeVisit: collector.beforeVisit,\n },\n });\n const globalVariables = supply(\n precooked.attemptToVisitGlobals,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n collectCoverage,\n widgetId,\n widgetVersion,\n app: currentApp,\n storyboardFunctions,\n isStoryboardFunction: true,\n }),\n !!collectCoverage\n );\n\n fn.cooked = cook(precooked.function, fn.source, {\n rules: {\n noVar: true,\n },\n globalVariables: overrides\n ? {\n ...globalVariables,\n ...(overrides?.LodashWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"_\")\n ? {\n _: {\n ...(globalVariables._ as typeof _),\n ...overrides.LodashWithStaticFields,\n },\n }\n : null),\n ...(overrides?.ArrayConstructor &&\n precooked.attemptToVisitGlobals.has(\"Array\")\n ? {\n Array: overrides.ArrayConstructor,\n }\n : null),\n ...(overrides?.ObjectWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"Object\")\n ? {\n Object: {\n ...(globalVariables.Object as typeof Object),\n ...overrides.ObjectWithStaticFields,\n },\n }\n : null),\n }\n : globalVariables,\n ArrayConstructor: overrides?.ArrayConstructor,\n hooks: collector && {\n beforeEvaluate: collector.beforeEvaluate,\n beforeCall: collector.beforeCall,\n beforeBranch: collector.beforeBranch,\n },\n debug: true,\n }) as Function;\n fn.processed = true;\n return fn.cooked;\n }\n\n return {\n storyboardFunctions,\n registerStoryboardFunctions,\n updateStoryboardFunction(\n name: string,\n data: StoryboardFunctionPatch\n ): void {\n const newFn = {\n ...data,\n name,\n };\n const deps = collectMemberUsageInFunction(newFn, \"FN\", true);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n newFn,\n \"PERMISSIONS\",\n true\n ).has(\"check\");\n registeredFunctions.set(name, {\n source: data.source,\n typescript: data.typescript,\n deps,\n hasPermissionsCheck,\n });\n },\n /**\n * Check whether listed functions attempt to call `PERMISSIONS.check()`,\n * includes in nested `FN.*()` calls.\n */\n checkPermissionsUsage(functionNames) {\n const checkedFunctions = new Set<string>();\n const hasPermissionsCheck = (name: string): boolean => {\n if (!checkedFunctions.has(name)) {\n checkedFunctions.add(name);\n const fn = registeredFunctions.get(name);\n return (\n !!fn &&\n (fn.hasPermissionsCheck || [...fn.deps].some(hasPermissionsCheck))\n );\n }\n return false;\n };\n return functionNames.some(hasPermissionsCheck);\n },\n clearGlobalExecutionContextStack() {\n __dev_only_clearGlobalExecutionContextStack();\n },\n getGlobalExecutionContextStack() {\n return __dev_only_getGlobalExecutionContextStack();\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAEA;;AAGA;;AAMA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MACdzB,mBAAmB,CAAC0B,GAAG,CAACC,IAAI,EAAE;QAC5BC,MAAM,EAAE0B,IAAI,CAAC1B,MAAM;QACnBC,UAAU,EAAEyB,IAAI,CAACzB,UAAU;QAC3BP,IAAI;QACJE;MACF,CAAC,CAAC;IACJ,CAAC;IACD;AACJ;AACA;AACA;IACIgC,qBAAqBA,CAACC,aAAa,EAAE;MACnC,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAS,CAAC;MAC1C,MAAMnC,mBAAmB,GAAIG,IAAY,IAAc;QACrD,IAAI,CAAC+B,gBAAgB,CAACjC,GAAG,CAACE,IAAI,CAAC,EAAE;UAC/B+B,gBAAgB,CAACE,GAAG,CAACjC,IAAI,CAAC;UAC1B,MAAMN,EAAE,GAAGrB,mBAAmB,CAACU,GAAG,CAACiB,IAAI,CAAC;UACxC,OACE,CAAC,CAACN,EAAE,KACHA,EAAE,CAACG,mBAAmB,IAAI,CAAC,GAAGH,EAAE,CAACC,IAAI,CAAC,CAACuC,IAAI,CAACrC,mBAAmB,CAAC,CAAC;QAEtE;QACA,OAAO,KAAK;MACd,CAAC;MACD,OAAOiC,aAAa,CAACI,IAAI,CAACrC,mBAAmB,CAAC;IAChD,CAAC;IACDsC,gCAAgCA,CAAA,EAAG;MACjC,IAAAC,iDAA2C,EAAC,CAAC;IAC/C,CAAC;IACDC,8BAA8BA,CAAA,EAAG;MAC/B,OAAO,IAAAC,+CAAyC,EAAC,CAAC;IACpD;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"StoryboardFunctionRegistry.js","names":["_cook","require","_supply","_storyboard","_getGeneralGlobals","StoryboardFunctionRegistryFactory","widgetId","widgetVersion","collectCoverage","debuggerOverrides","registeredFunctions","Map","overrides","precookFunction","cook","supply","storyboardFunctions","Proxy","Object","freeze","get","_target","key","getStoryboardFunction","currentApp","registerStoryboardFunctions","functions","app","clear","Array","isArray","fn","deps","collectMemberUsageInFunction","hasPermissionsCheck","has","set","name","source","typescript","undefined","processed","cooked","collector","createCollector","precooked","hooks","beforeVisit","globalVariables","attemptToVisitGlobals","getGeneralGlobals","isStoryboardFunction","function","rules","noVar","LodashWithStaticFields","_","ArrayConstructor","ObjectWithStaticFields","beforeEvaluate","beforeCall","beforeBranch","debug","updateStoryboardFunction","data","newFn","checkPermissionsUsage","functionNames","checkedFunctions","Set","add","some","clearGlobalExecutionContextStack","__dev_only_clearGlobalExecutionContextStack","getGlobalExecutionContextStack","__dev_only_getGlobalExecutionContextStack"],"sources":["../../src/StoryboardFunctionRegistry.ts"],"sourcesContent":["import type { MicroApp, StoryboardFunction } from \"@next-core/types\";\nimport {\n cook,\n precookFunction,\n EstreeNode,\n __dev_only_clearGlobalExecutionContextStack,\n __dev_only_getGlobalExecutionContextStack,\n} from \"@next-core/cook\";\nimport { supply } from \"@next-core/supply\";\nimport { collectMemberUsageInFunction } from \"@next-core/utils/storyboard\";\nimport type _ from \"lodash\";\nimport { getGeneralGlobals } from \"./internal/compute/getGeneralGlobals.js\";\n\n/** @internal */\nexport type ReadonlyStoryboardFunctions = Readonly<Record<string, Function>>;\n\n/** @internal */\nexport type StoryboardFunctionPatch = Pick<\n StoryboardFunction,\n \"source\" | \"typescript\"\n>;\n\n/** @internal */\nexport interface StoryboardFunctionRegistry {\n /** A readonly proxy for accessing cooked storyboard functions. */\n storyboardFunctions: ReadonlyStoryboardFunctions;\n\n /** Register storyboard functions. */\n registerStoryboardFunctions(\n functions: StoryboardFunction[] | undefined,\n app?: PartialMicroApp\n ): void;\n\n /** Update a storyboard function during debugging. */\n updateStoryboardFunction(name: string, data: StoryboardFunctionPatch): void;\n\n checkPermissionsUsage(functionNames: string[]): boolean;\n\n clearGlobalExecutionContextStack(): void;\n getGlobalExecutionContextStack(): ReturnType<\n typeof __dev_only_getGlobalExecutionContextStack\n >;\n}\n\n/** @internal */\nexport interface RuntimeStoryboardFunction {\n source: string;\n typescript?: boolean;\n processed?: boolean;\n cooked?: Function;\n deps: Set<string>;\n hasPermissionsCheck: boolean;\n}\n\n/** @internal */\nexport interface FunctionCoverageCollector {\n beforeVisit(node: EstreeNode): void;\n beforeEvaluate(node: EstreeNode): void;\n beforeCall(node: EstreeNode): void;\n beforeBranch(node: EstreeNode, branch: string): void;\n}\n\n/** @internal */\nexport interface FunctionCoverageSettings {\n createCollector(name: string): FunctionCoverageCollector;\n}\n\n/** @internal */\nexport type PartialMicroApp = Pick<MicroApp, \"id\" | \"isBuildPush\">;\n\n/** @internal */\nexport function StoryboardFunctionRegistryFactory({\n widgetId,\n widgetVersion,\n collectCoverage,\n debuggerOverrides,\n}: {\n widgetId?: string;\n widgetVersion?: string;\n collectCoverage?: FunctionCoverageSettings;\n debuggerOverrides?: (ctx: {\n precookFunction: typeof precookFunction;\n cook: typeof cook;\n supply: typeof supply;\n }) => {\n LodashWithStaticFields?: Partial<typeof _>;\n ArrayConstructor?: typeof Array;\n ObjectWithStaticFields?: Partial<typeof Object>;\n };\n} = {}): StoryboardFunctionRegistry {\n const registeredFunctions = new Map<string, RuntimeStoryboardFunction>();\n\n const overrides = debuggerOverrides?.({\n precookFunction,\n cook,\n supply,\n });\n\n // Use `Proxy` with a frozen target, to make a readonly function registry.\n const storyboardFunctions = new Proxy(Object.freeze({}), {\n get(_target, key) {\n return getStoryboardFunction(key as string);\n },\n }) as ReadonlyStoryboardFunctions;\n\n let currentApp: PartialMicroApp | undefined;\n\n function registerStoryboardFunctions(\n functions: StoryboardFunction[],\n app?: PartialMicroApp\n ): void {\n if (app) {\n currentApp = app;\n }\n registeredFunctions.clear();\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n const deps = collectMemberUsageInFunction(fn, \"FN\", !!collectCoverage);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n fn,\n \"PERMISSIONS\",\n !!collectCoverage\n ).has(\"check\");\n registeredFunctions.set(fn.name, {\n source: fn.source,\n typescript: fn.typescript,\n deps,\n hasPermissionsCheck,\n });\n }\n }\n }\n\n function getStoryboardFunction(name: string): Function | undefined {\n const fn = registeredFunctions.get(name);\n if (!fn) {\n return undefined;\n }\n if (fn.processed) {\n return fn.cooked;\n }\n let collector: FunctionCoverageCollector | undefined;\n if (collectCoverage) {\n collector = collectCoverage.createCollector(name);\n }\n const precooked = precookFunction(fn.source, {\n typescript: fn.typescript,\n hooks: collector && {\n beforeVisit: collector.beforeVisit,\n },\n });\n const globalVariables = supply(\n precooked.attemptToVisitGlobals,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n collectCoverage,\n widgetId,\n widgetVersion,\n app: currentApp,\n storyboardFunctions,\n isStoryboardFunction: true,\n }),\n !!collectCoverage\n );\n\n fn.cooked = cook(precooked.function, fn.source, {\n rules: {\n noVar: true,\n },\n globalVariables: overrides\n ? {\n ...globalVariables,\n ...(overrides?.LodashWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"_\")\n ? {\n _: {\n ...(globalVariables._ as typeof _),\n ...overrides.LodashWithStaticFields,\n },\n }\n : null),\n ...(overrides?.ArrayConstructor &&\n precooked.attemptToVisitGlobals.has(\"Array\")\n ? {\n Array: overrides.ArrayConstructor,\n }\n : null),\n ...(overrides?.ObjectWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"Object\")\n ? {\n Object: {\n ...(globalVariables.Object as typeof Object),\n ...overrides.ObjectWithStaticFields,\n },\n }\n : null),\n }\n : globalVariables,\n ArrayConstructor: overrides?.ArrayConstructor,\n hooks: collector && {\n beforeEvaluate: collector.beforeEvaluate,\n beforeCall: collector.beforeCall,\n beforeBranch: collector.beforeBranch,\n },\n debug: !!debuggerOverrides,\n }) as Function;\n fn.processed = true;\n return fn.cooked;\n }\n\n return {\n storyboardFunctions,\n registerStoryboardFunctions,\n updateStoryboardFunction(\n name: string,\n data: StoryboardFunctionPatch\n ): void {\n const newFn = {\n ...data,\n name,\n };\n const deps = collectMemberUsageInFunction(newFn, \"FN\", true);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n newFn,\n \"PERMISSIONS\",\n true\n ).has(\"check\");\n registeredFunctions.set(name, {\n source: data.source,\n typescript: data.typescript,\n deps,\n hasPermissionsCheck,\n });\n },\n /**\n * Check whether listed functions attempt to call `PERMISSIONS.check()`,\n * includes in nested `FN.*()` calls.\n */\n checkPermissionsUsage(functionNames) {\n const checkedFunctions = new Set<string>();\n const hasPermissionsCheck = (name: string): boolean => {\n if (!checkedFunctions.has(name)) {\n checkedFunctions.add(name);\n const fn = registeredFunctions.get(name);\n return (\n !!fn &&\n (fn.hasPermissionsCheck || [...fn.deps].some(hasPermissionsCheck))\n );\n }\n return false;\n };\n return functionNames.some(hasPermissionsCheck);\n },\n clearGlobalExecutionContextStack() {\n __dev_only_clearGlobalExecutionContextStack();\n },\n getGlobalExecutionContextStack() {\n return __dev_only_getGlobalExecutionContextStack();\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAEA;;AAGA;;AAMA;;AAsBA;;AAUA;;AAQA;;AAKA;;AAGA;AACO,SAASI,iCAAiCA,CAAC;EAChDC,QAAQ;EACRC,aAAa;EACbC,eAAe;EACfC;AAcF,CAAC,GAAG,CAAC,CAAC,EAA8B;EAClC,MAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAAoC,CAAC;EAExE,MAAMC,SAAS,GAAGH,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAG;IACpCI,eAAe,EAAfA,qBAAe;IACfC,IAAI,EAAJA,UAAI;IACJC,MAAM,EAANA;EACF,CAAC,CAAC;;EAEF;EACA,MAAMC,mBAAmB,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;IACvDC,GAAGA,CAACC,OAAO,EAAEC,GAAG,EAAE;MAChB,OAAOC,qBAAqB,CAACD,GAAa,CAAC;IAC7C;EACF,CAAC,CAAgC;EAEjC,IA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IAAI,CAAC,GAAGH,EAAE,CAACC,IAAI,CAAC,CAACuC,IAAI,CAACrC,mBAAmB,CAAC,CAAC;QAEtE;QACA,OAAO,KAAK;MACd,CAAC;MACD,OAAOiC,aAAa,CAACI,IAAI,CAACrC,mBAAmB,CAAC;IAChD,CAAC;IACDsC,gCAAgCA,CAAA,EAAG;MACjC,IAAAC,iDAA2C,EAAC,CAAC;IAC/C,CAAC;IACDC,8BAA8BA,CAAA,EAAG;MAC/B,OAAO,IAAAC,+CAAyC,EAAC,CAAC;IACpD;EACF,CAAC;AACH","ignoreList":[]}
@@ -111,7 +111,7 @@ export function StoryboardFunctionRegistryFactory() {
111
111
  beforeCall: collector.beforeCall,
112
112
  beforeBranch: collector.beforeBranch
113
113
  },
114
- debug: true
114
+ debug: !!debuggerOverrides
115
115
  });
116
116
  fn.processed = true;
117
117
  return fn.cooked;
@@ -1 +1 @@
1
- {"version":3,"file":"StoryboardFunctionRegistry.js","names":["cook","precookFunction","__dev_only_clearGlobalExecutionContextStack","__dev_only_getGlobalExecutionContextStack","supply","collectMemberUsageInFunction","getGeneralGlobals","StoryboardFunctionRegistryFactory","widgetId","widgetVersion","collectCoverage","debuggerOverrides","arguments","length","undefined","registeredFunctions","Map","overrides","storyboardFunctions","Proxy","Object","freeze","get","_target","key","getStoryboardFunction","currentApp","registerStoryboardFunctions","functions","app","clear","Array","isArray","fn","deps","hasPermissionsCheck","has","set","name","source","typescript","processed","cooked","collector","createCollector","precooked","hooks","beforeVisit","globalVariables","attemptToVisitGlobals","isStoryboardFunction","function","rules","noVar","LodashWithStaticFields","_","ArrayConstructor","ObjectWithStaticFields","beforeEvaluate","beforeCall","beforeBranch","debug","updateStoryboardFunction","data","newFn","checkPermissionsUsage","functionNames","checkedFunctions","Set","add","some","clearGlobalExecutionContextStack","getGlobalExecutionContextStack"],"sources":["../../src/StoryboardFunctionRegistry.ts"],"sourcesContent":["import type { MicroApp, StoryboardFunction } from \"@next-core/types\";\nimport {\n cook,\n precookFunction,\n EstreeNode,\n __dev_only_clearGlobalExecutionContextStack,\n __dev_only_getGlobalExecutionContextStack,\n} from \"@next-core/cook\";\nimport { supply } from \"@next-core/supply\";\nimport { collectMemberUsageInFunction } from \"@next-core/utils/storyboard\";\nimport type _ from \"lodash\";\nimport { getGeneralGlobals } from \"./internal/compute/getGeneralGlobals.js\";\n\n/** @internal */\nexport type ReadonlyStoryboardFunctions = Readonly<Record<string, Function>>;\n\n/** @internal */\nexport type StoryboardFunctionPatch = Pick<\n StoryboardFunction,\n \"source\" | \"typescript\"\n>;\n\n/** @internal */\nexport interface StoryboardFunctionRegistry {\n /** A readonly proxy for accessing cooked storyboard functions. */\n storyboardFunctions: ReadonlyStoryboardFunctions;\n\n /** Register storyboard functions. */\n registerStoryboardFunctions(\n functions: StoryboardFunction[] | undefined,\n app?: PartialMicroApp\n ): void;\n\n /** Update a storyboard function during debugging. */\n updateStoryboardFunction(name: string, data: StoryboardFunctionPatch): void;\n\n checkPermissionsUsage(functionNames: string[]): boolean;\n\n clearGlobalExecutionContextStack(): void;\n getGlobalExecutionContextStack(): ReturnType<\n typeof __dev_only_getGlobalExecutionContextStack\n >;\n}\n\n/** @internal */\nexport interface RuntimeStoryboardFunction {\n source: string;\n typescript?: boolean;\n processed?: boolean;\n cooked?: Function;\n deps: Set<string>;\n hasPermissionsCheck: boolean;\n}\n\n/** @internal */\nexport interface FunctionCoverageCollector {\n beforeVisit(node: EstreeNode): void;\n beforeEvaluate(node: EstreeNode): void;\n beforeCall(node: EstreeNode): void;\n beforeBranch(node: EstreeNode, branch: string): void;\n}\n\n/** @internal */\nexport interface FunctionCoverageSettings {\n createCollector(name: string): FunctionCoverageCollector;\n}\n\n/** @internal */\nexport type PartialMicroApp = Pick<MicroApp, \"id\" | \"isBuildPush\">;\n\n/** @internal */\nexport function StoryboardFunctionRegistryFactory({\n widgetId,\n widgetVersion,\n collectCoverage,\n debuggerOverrides,\n}: {\n widgetId?: string;\n widgetVersion?: string;\n collectCoverage?: FunctionCoverageSettings;\n debuggerOverrides?: (ctx: {\n precookFunction: typeof precookFunction;\n cook: typeof cook;\n supply: typeof supply;\n }) => {\n LodashWithStaticFields?: Partial<typeof _>;\n ArrayConstructor?: typeof Array;\n ObjectWithStaticFields?: Partial<typeof Object>;\n };\n} = {}): StoryboardFunctionRegistry {\n const registeredFunctions = new Map<string, RuntimeStoryboardFunction>();\n\n const overrides = debuggerOverrides?.({\n precookFunction,\n cook,\n supply,\n });\n\n // Use `Proxy` with a frozen target, to make a readonly function registry.\n const storyboardFunctions = new Proxy(Object.freeze({}), {\n get(_target, key) {\n return getStoryboardFunction(key as string);\n },\n }) as ReadonlyStoryboardFunctions;\n\n let currentApp: PartialMicroApp | undefined;\n\n function registerStoryboardFunctions(\n functions: StoryboardFunction[],\n app?: PartialMicroApp\n ): void {\n if (app) {\n currentApp = app;\n }\n registeredFunctions.clear();\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n const deps = collectMemberUsageInFunction(fn, \"FN\", !!collectCoverage);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n fn,\n \"PERMISSIONS\",\n !!collectCoverage\n ).has(\"check\");\n registeredFunctions.set(fn.name, {\n source: fn.source,\n typescript: fn.typescript,\n deps,\n hasPermissionsCheck,\n });\n }\n }\n }\n\n function getStoryboardFunction(name: string): Function | undefined {\n const fn = registeredFunctions.get(name);\n if (!fn) {\n return undefined;\n }\n if (fn.processed) {\n return fn.cooked;\n }\n let collector: FunctionCoverageCollector | undefined;\n if (collectCoverage) {\n collector = collectCoverage.createCollector(name);\n }\n const precooked = precookFunction(fn.source, {\n typescript: fn.typescript,\n hooks: collector && {\n beforeVisit: collector.beforeVisit,\n },\n });\n const globalVariables = supply(\n precooked.attemptToVisitGlobals,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n collectCoverage,\n widgetId,\n widgetVersion,\n app: currentApp,\n storyboardFunctions,\n isStoryboardFunction: true,\n }),\n !!collectCoverage\n );\n\n fn.cooked = cook(precooked.function, fn.source, {\n rules: {\n noVar: true,\n },\n globalVariables: overrides\n ? {\n ...globalVariables,\n ...(overrides?.LodashWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"_\")\n ? {\n _: {\n ...(globalVariables._ as typeof _),\n ...overrides.LodashWithStaticFields,\n },\n }\n : null),\n ...(overrides?.ArrayConstructor &&\n precooked.attemptToVisitGlobals.has(\"Array\")\n ? {\n Array: overrides.ArrayConstructor,\n }\n : null),\n ...(overrides?.ObjectWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"Object\")\n ? {\n Object: {\n ...(globalVariables.Object as typeof Object),\n ...overrides.ObjectWithStaticFields,\n },\n }\n : null),\n }\n : globalVariables,\n ArrayConstructor: overrides?.ArrayConstructor,\n hooks: collector && {\n beforeEvaluate: collector.beforeEvaluate,\n beforeCall: collector.beforeCall,\n beforeBranch: collector.beforeBranch,\n },\n debug: true,\n }) as Function;\n fn.processed = true;\n return fn.cooked;\n }\n\n return {\n storyboardFunctions,\n registerStoryboardFunctions,\n updateStoryboardFunction(\n name: string,\n data: StoryboardFunctionPatch\n ): void {\n const newFn = {\n ...data,\n name,\n };\n const deps = collectMemberUsageInFunction(newFn, \"FN\", true);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n newFn,\n \"PERMISSIONS\",\n true\n ).has(\"check\");\n registeredFunctions.set(name, {\n source: data.source,\n typescript: data.typescript,\n deps,\n hasPermissionsCheck,\n });\n },\n /**\n * Check whether listed functions attempt to call `PERMISSIONS.check()`,\n * includes in nested `FN.*()` calls.\n */\n checkPermissionsUsage(functionNames) {\n const checkedFunctions = new Set<string>();\n const hasPermissionsCheck = (name: string): boolean => {\n if (!checkedFunctions.has(name)) {\n checkedFunctions.add(name);\n const fn = registeredFunctions.get(name);\n return (\n !!fn &&\n (fn.hasPermissionsCheck || [...fn.deps].some(hasPermissionsCheck))\n );\n }\n return false;\n };\n return functionNames.some(hasPermissionsCheck);\n },\n clearGlobalExecutionContextStack() {\n __dev_only_clearGlobalExecutionContextStack();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ctionRegistry.js","names":["cook","precookFunction","__dev_only_clearGlobalExecutionContextStack","__dev_only_getGlobalExecutionContextStack","supply","collectMemberUsageInFunction","getGeneralGlobals","StoryboardFunctionRegistryFactory","widgetId","widgetVersion","collectCoverage","debuggerOverrides","arguments","length","undefined","registeredFunctions","Map","overrides","storyboardFunctions","Proxy","Object","freeze","get","_target","key","getStoryboardFunction","currentApp","registerStoryboardFunctions","functions","app","clear","Array","isArray","fn","deps","hasPermissionsCheck","has","set","name","source","typescript","processed","cooked","collector","createCollector","precooked","hooks","beforeVisit","globalVariables","attemptToVisitGlobals","isStoryboardFunction","function","rules","noVar","LodashWithStaticFields","_","ArrayConstructor","ObjectWithStaticFields","beforeEvaluate","beforeCall","beforeBranch","debug","updateStoryboardFunction","data","newFn","checkPermissionsUsage","functionNames","checkedFunctions","Set","add","some","clearGlobalExecutionContextStack","getGlobalExecutionContextStack"],"sources":["../../src/StoryboardFunctionRegistry.ts"],"sourcesContent":["import type { MicroApp, StoryboardFunction } from \"@next-core/types\";\nimport {\n cook,\n precookFunction,\n EstreeNode,\n __dev_only_clearGlobalExecutionContextStack,\n __dev_only_getGlobalExecutionContextStack,\n} from \"@next-core/cook\";\nimport { supply } from \"@next-core/supply\";\nimport { collectMemberUsageInFunction } from \"@next-core/utils/storyboard\";\nimport type _ from \"lodash\";\nimport { getGeneralGlobals } from \"./internal/compute/getGeneralGlobals.js\";\n\n/** @internal */\nexport type ReadonlyStoryboardFunctions = Readonly<Record<string, Function>>;\n\n/** @internal */\nexport type StoryboardFunctionPatch = Pick<\n StoryboardFunction,\n \"source\" | \"typescript\"\n>;\n\n/** @internal */\nexport interface StoryboardFunctionRegistry {\n /** A readonly proxy for accessing cooked storyboard functions. */\n storyboardFunctions: ReadonlyStoryboardFunctions;\n\n /** Register storyboard functions. */\n registerStoryboardFunctions(\n functions: StoryboardFunction[] | undefined,\n app?: PartialMicroApp\n ): void;\n\n /** Update a storyboard function during debugging. */\n updateStoryboardFunction(name: string, data: StoryboardFunctionPatch): void;\n\n checkPermissionsUsage(functionNames: string[]): boolean;\n\n clearGlobalExecutionContextStack(): void;\n getGlobalExecutionContextStack(): ReturnType<\n typeof __dev_only_getGlobalExecutionContextStack\n >;\n}\n\n/** @internal */\nexport interface RuntimeStoryboardFunction {\n source: string;\n typescript?: boolean;\n processed?: boolean;\n cooked?: Function;\n deps: Set<string>;\n hasPermissionsCheck: boolean;\n}\n\n/** @internal */\nexport interface FunctionCoverageCollector {\n beforeVisit(node: EstreeNode): void;\n beforeEvaluate(node: EstreeNode): void;\n beforeCall(node: EstreeNode): void;\n beforeBranch(node: EstreeNode, branch: string): void;\n}\n\n/** @internal */\nexport interface FunctionCoverageSettings {\n createCollector(name: string): FunctionCoverageCollector;\n}\n\n/** @internal */\nexport type PartialMicroApp = Pick<MicroApp, \"id\" | \"isBuildPush\">;\n\n/** @internal */\nexport function StoryboardFunctionRegistryFactory({\n widgetId,\n widgetVersion,\n collectCoverage,\n debuggerOverrides,\n}: {\n widgetId?: string;\n widgetVersion?: string;\n collectCoverage?: FunctionCoverageSettings;\n debuggerOverrides?: (ctx: {\n precookFunction: typeof precookFunction;\n cook: typeof cook;\n supply: typeof supply;\n }) => {\n LodashWithStaticFields?: Partial<typeof _>;\n ArrayConstructor?: typeof Array;\n ObjectWithStaticFields?: Partial<typeof Object>;\n };\n} = {}): StoryboardFunctionRegistry {\n const registeredFunctions = new Map<string, RuntimeStoryboardFunction>();\n\n const overrides = debuggerOverrides?.({\n precookFunction,\n cook,\n supply,\n });\n\n // Use `Proxy` with a frozen target, to make a readonly function registry.\n const storyboardFunctions = new Proxy(Object.freeze({}), {\n get(_target, key) {\n return getStoryboardFunction(key as string);\n },\n }) as ReadonlyStoryboardFunctions;\n\n let currentApp: PartialMicroApp | undefined;\n\n function registerStoryboardFunctions(\n functions: StoryboardFunction[],\n app?: PartialMicroApp\n ): void {\n if (app) {\n currentApp = app;\n }\n registeredFunctions.clear();\n if (Array.isArray(functions)) {\n for (const fn of functions) {\n const deps = collectMemberUsageInFunction(fn, \"FN\", !!collectCoverage);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n fn,\n \"PERMISSIONS\",\n !!collectCoverage\n ).has(\"check\");\n registeredFunctions.set(fn.name, {\n source: fn.source,\n typescript: fn.typescript,\n deps,\n hasPermissionsCheck,\n });\n }\n }\n }\n\n function getStoryboardFunction(name: string): Function | undefined {\n const fn = registeredFunctions.get(name);\n if (!fn) {\n return undefined;\n }\n if (fn.processed) {\n return fn.cooked;\n }\n let collector: FunctionCoverageCollector | undefined;\n if (collectCoverage) {\n collector = collectCoverage.createCollector(name);\n }\n const precooked = precookFunction(fn.source, {\n typescript: fn.typescript,\n hooks: collector && {\n beforeVisit: collector.beforeVisit,\n },\n });\n const globalVariables = supply(\n precooked.attemptToVisitGlobals,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n collectCoverage,\n widgetId,\n widgetVersion,\n app: currentApp,\n storyboardFunctions,\n isStoryboardFunction: true,\n }),\n !!collectCoverage\n );\n\n fn.cooked = cook(precooked.function, fn.source, {\n rules: {\n noVar: true,\n },\n globalVariables: overrides\n ? {\n ...globalVariables,\n ...(overrides?.LodashWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"_\")\n ? {\n _: {\n ...(globalVariables._ as typeof _),\n ...overrides.LodashWithStaticFields,\n },\n }\n : null),\n ...(overrides?.ArrayConstructor &&\n precooked.attemptToVisitGlobals.has(\"Array\")\n ? {\n Array: overrides.ArrayConstructor,\n }\n : null),\n ...(overrides?.ObjectWithStaticFields &&\n precooked.attemptToVisitGlobals.has(\"Object\")\n ? {\n Object: {\n ...(globalVariables.Object as typeof Object),\n ...overrides.ObjectWithStaticFields,\n },\n }\n : null),\n }\n : globalVariables,\n ArrayConstructor: overrides?.ArrayConstructor,\n hooks: collector && {\n beforeEvaluate: collector.beforeEvaluate,\n beforeCall: collector.beforeCall,\n beforeBranch: collector.beforeBranch,\n },\n debug: !!debuggerOverrides,\n }) as Function;\n fn.processed = true;\n return fn.cooked;\n }\n\n return {\n storyboardFunctions,\n registerStoryboardFunctions,\n updateStoryboardFunction(\n name: string,\n data: StoryboardFunctionPatch\n ): void {\n const newFn = {\n ...data,\n name,\n };\n const deps = collectMemberUsageInFunction(newFn, \"FN\", true);\n const hasPermissionsCheck = collectMemberUsageInFunction(\n newFn,\n \"PERMISSIONS\",\n true\n ).has(\"check\");\n registeredFunctions.set(name, {\n source: data.source,\n typescript: data.typescript,\n deps,\n hasPermissionsCheck,\n });\n },\n /**\n * Check whether listed functions attempt to call `PERMISSIONS.check()`,\n * includes in nested `FN.*()` calls.\n */\n checkPermissionsUsage(functionNames) {\n const checkedFunctions = new Set<string>();\n const hasPermissionsCheck = (name: string): boolean => {\n if (!checkedFunctions.has(name)) {\n checkedFunctions.add(name);\n const fn = registeredFunctions.get(name);\n return (\n !!fn &&\n (fn.hasPermissionsCheck || [...fn.deps].some(hasPermissionsCheck))\n );\n }\n return false;\n };\n return functionNames.some(hasPermissionsCheck);\n },\n clearGlobalExecutionContextStack() {\n __dev_only_clearGlobalExecutionContextStack();\n },\n getGlobalExecutionContextStack() {\n return __dev_only_getGlobalExecutionContextStack();\n },\n };\n}\n"],"mappings":"AACA,SACEA,IAAI,EACJC,eAAe,EAEfC,2CAA2C,EAC3CC,yCAAyC,QACpC,iBAAiB;AACxB,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,4BAA4B,QAAQ,6BAA6B;AAE1E,SAASC,iBAAiB,QAAQ,yCAAyC;;AAE3E;;AAGA;;AAMA;;AAsBA;;AAUA;;AAQA;;AAKA;;AAGA;AACA,OAAO,SAASC,iCAAiCA,CAAA,EAkBb;EAAA,IAlBc;IAChDC,QAAQ;IACRC,aAAa;IACbC,eAAe;IACfC;EAcF,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACJ,MAAMG,mBAAmB,GAAG,IAAIC,GAAG,CAAoC,CAAC;E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G,CAAS,CAAC;MAC1C,MAAMjC,mBAAmB,GAAIG,IAAY,IAAc;QACrD,IAAI,CAAC6B,gBAAgB,CAAC/B,GAAG,CAACE,IAAI,CAAC,EAAE;UAC/B6B,gBAAgB,CAACE,GAAG,CAAC/B,IAAI,CAAC;UAC1B,MAAML,EAAE,GAAGlB,mBAAmB,CAACO,GAAG,CAACgB,IAAI,CAAC;UACxC,OACE,CAAC,CAACL,EAAE,KACHA,EAAE,CAACE,mBAAmB,IAAI,CAAC,GAAGF,EAAE,CAACC,IAAI,CAAC,CAACoC,IAAI,CAACnC,mBAAmB,CAAC,CAAC;QAEtE;QACA,OAAO,KAAK;MACd,CAAC;MACD,OAAO+B,aAAa,CAACI,IAAI,CAACnC,mBAAmB,CAAC;IAChD,CAAC;IACDoC,gCAAgCA,CAAA,EAAG;MACjCrE,2CAA2C,CAAC,CAAC;IAC/C,CAAC;IACDsE,8BAA8BA,CAAA,EAAG;MAC/B,OAAOrE,yCAAyC,CAAC,CAAC;IACpD;EACF,CAAC;AACH","ignoreList":[]}
@@ -10,7 +10,7 @@ export declare class Router {
10
10
  previousApp: MicroApp | undefined;
11
11
  };
12
12
  getNavConfig(): {
13
- breadcrumb?: BreadcrumbItemConf[] | undefined;
13
+ breadcrumb?: BreadcrumbItemConf[];
14
14
  } | undefined;
15
15
  bootstrap(): Promise<void>;
16
16
  }
@@ -94,7 +94,7 @@ export declare class Runtime {
94
94
  toggleLaunchpadEffect(open: boolean): void;
95
95
  applyPageTitle(pageTitle: string): void;
96
96
  getNavConfig(): {
97
- breadcrumb?: import("@next-core/types").BreadcrumbItemConf[] | undefined;
97
+ breadcrumb?: import("@next-core/types").BreadcrumbItemConf[];
98
98
  } | undefined;
99
99
  loadBricks(bricks: string[] | Set<string>): Promise<void>;
100
100
  }
@@ -1 +1 @@
1
- export declare const storyboardFunctions: Readonly<Record<string, Function>>, registerStoryboardFunctions: (functions: import("@next-core/types").StoryboardFunction[] | undefined, app?: import("../../StoryboardFunctionRegistry.js").PartialMicroApp | undefined) => void, checkPermissionsUsage: (functionNames: string[]) => boolean;
1
+ export declare const storyboardFunctions: Readonly<Record<string, Function>>, registerStoryboardFunctions: (functions: import("@next-core/types").StoryboardFunction[] | undefined, app?: import("../../StoryboardFunctionRegistry.js").PartialMicroApp) => void, checkPermissionsUsage: (functionNames: string[]) => boolean;
@@ -1,3 +1,4 @@
1
1
  import { StoryboardFunction } from "@next-core/types";
2
- export declare const widgetFunctions: Readonly<Record<string, Readonly<Record<string, Function>>>>;
2
+ import { ReadonlyStoryboardFunctions } from "../../StoryboardFunctionRegistry.js";
3
+ export declare const widgetFunctions: Readonly<Record<string, ReadonlyStoryboardFunctions>>;
3
4
  export declare const registerWidgetFunctions: (widgetId: string, functions: StoryboardFunction[], widgetVersion?: string) => void;
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../../../../declarations/global.d.ts" />
2
1
  import type { BatchUpdateContextItem, BrickEventHandlerCallback, ContextConf, RouteConf } from "@next-core/types";
3
2
  import EventTarget from "@ungap/event-target";
4
3
  import { ResolveOptions } from "./resolveData.js";
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../../../declarations/global.d.ts" />
2
1
  import EventTarget from "@ungap/event-target";
3
2
  export interface Media {
4
3
  breakpoint?: MediaBreakpoint;
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.46.2"
8
+ "packageVersion": "7.47.0"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/runtime",
3
- "version": "1.49.5",
3
+ "version": "1.49.7",
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.3",
49
- "@next-core/http": "^1.2.4",
50
- "@next-core/i18n": "^1.0.54",
51
- "@next-core/inject": "^1.0.37",
52
- "@next-core/loader": "^1.6.1",
53
- "@next-core/supply": "^2.1.18",
54
- "@next-core/types": "^1.11.1",
55
- "@next-core/utils": "^1.7.12",
48
+ "@next-core/cook": "^2.4.4",
49
+ "@next-core/http": "^1.2.5",
50
+ "@next-core/i18n": "^1.0.55",
51
+ "@next-core/inject": "^1.0.38",
52
+ "@next-core/loader": "^1.6.2",
53
+ "@next-core/supply": "^2.1.19",
54
+ "@next-core/types": "^1.11.2",
55
+ "@next-core/utils": "^1.7.13",
56
56
  "@ungap/event-target": "^0.2.4",
57
57
  "compare-versions": "^6.1.0",
58
58
  "history": "^4.10.1",
@@ -61,11 +61,11 @@
61
61
  "path-to-regexp": "^6.2.2"
62
62
  },
63
63
  "devDependencies": {
64
- "@microsoft/api-extractor": "^7.46.2",
64
+ "@microsoft/api-extractor": "^7.47.0",
65
65
  "@next-api-sdk/api-gateway-sdk": "^1.1.0",
66
66
  "@next-api-sdk/micro-app-sdk": "^1.2.1",
67
- "@next-core/build-next-libs": "^1.0.17",
68
- "@next-core/test-next": "^1.1.3"
67
+ "@next-core/build-next-libs": "^1.0.18",
68
+ "@next-core/test-next": "^1.1.4"
69
69
  },
70
- "gitHead": "fa4d26c3d31fc8344c38bdf7002613ba59b3e8c2"
70
+ "gitHead": "23945f928c053a17a89d911d44b0fd17bcdd20b0"
71
71
  }