PromoCursed/node_modules/.cache/babel-loader/0ca75bbe01bd0be2110abc43ad8d76379bccfdb36624cac073a7c749063f4114.json

1 line
8.2 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import createMachine from \"./fsm.js\";\n\n/**\n * @typedef {Object} ShowOverlayData\n * @property {'warning' | 'error'} level\n * @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages\n * @property {'build' | 'runtime'} messageSource\n */\n\n/**\n * @typedef {Object} CreateOverlayMachineOptions\n * @property {(data: ShowOverlayData) => void} showOverlay\n * @property {() => void} hideOverlay\n */\n\n/**\n * @param {CreateOverlayMachineOptions} options\n */\nvar createOverlayMachine = function createOverlayMachine(options) {\n var hideOverlay = options.hideOverlay,\n showOverlay = options.showOverlay;\n var overlayMachine = createMachine({\n initial: \"hidden\",\n context: {\n level: \"error\",\n messages: [],\n messageSource: \"build\"\n },\n states: {\n hidden: {\n on: {\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"setMessages\", \"showOverlay\"]\n },\n RUNTIME_ERROR: {\n target: \"displayRuntimeError\",\n actions: [\"setMessages\", \"showOverlay\"]\n }\n }\n },\n displayBuildError: {\n on: {\n DISMISS: {\n target: \"hidden\",\n actions: [\"dismissMessages\", \"hideOverlay\"]\n },\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"appendMessages\", \"showOverlay\"]\n }\n }\n },\n displayRuntimeError: {\n on: {\n DISMISS: {\n target: \"hidden\",\n actions: [\"dismissMessages\", \"hideOverlay\"]\n },\n RUNTIME_ERROR: {\n target: \"displayRuntimeError\",\n actions: [\"appendMessages\", \"showOverlay\"]\n },\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"setMessages\", \"showOverlay\"]\n }\n }\n }\n }\n }, {\n actions: {\n dismissMessages: function dismissMessages() {\n return {\n messages: [],\n level: \"error\",\n messageSource: \"build\"\n };\n },\n appendMessages: function appendMessages(context, event) {\n return {\n messages: context.messages.concat(event.messages),\n level: event.level || context.level,\n messageSource: event.type === \"RUNTIME_ERROR\" ? \"runtime\" : \"build\"\n };\n },\n setMessages: function setMessages(context, event) {\n return {\n messages: event.messages,\n level: event.level || context.level,\n messageSource: event.type === \"RUNTIME_ERROR\" ? \"runtime\" : \"build\"\n };\n },\n hideOverlay: hideOverlay,\n showOverlay: showOverlay\n }\n });\n return overlayMachine;\n};\nexport default createOverlayMachine;","map":{"version":3,"names":["createMachine","createOverlayMachine","options","hideOverlay","showOverlay","overlayMachine","initial","context","level","messages","messageSource","states","hidden","on","BUILD_ERROR","target","actions","RUNTIME_ERROR","displayBuildError","DISMISS","displayRuntimeError","dismissMessages","appendMessages","event","concat","type","setMessages"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/webpack-dev-server/client/overlay/state-machine.js"],"sourcesContent":["import createMachine from \"./fsm.js\";\n\n/**\n * @typedef {Object} ShowOverlayData\n * @property {'warning' | 'error'} level\n * @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages\n * @property {'build' | 'runtime'} messageSource\n */\n\n/**\n * @typedef {Object} CreateOverlayMachineOptions\n * @property {(data: ShowOverlayData) => void} showOverlay\n * @property {() => void} hideOverlay\n */\n\n/**\n * @param {CreateOverlayMachineOptions} options\n */\nvar createOverlayMachine = function createOverlayMachine(options) {\n var hideOve