the-forest/client/node_modules/.cache/babel-loader/9ac55d6bc34e8523ce6be4bdcd0e74afdf274d545cec31b5b3dc66c4db266146.json

1 line
8.2 KiB
JSON
Raw Normal View History

2024-09-17 20:35:18 -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":["/Users/shoofle/Projects/the-forest/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 hideOverlay