Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/@vitejs/plugin-react/dist/refreshUtils.js
rd565449 r0c6b92a 8 8 9 9 /* eslint-disable no-undef */ 10 const enqueueUpdate = debounce(exports.performReactRefresh, 16) 10 const hooks = [] 11 window.__registerBeforePerformReactRefresh = (cb) => { 12 hooks.push(cb) 13 } 14 const enqueueUpdate = debounce(async () => { 15 if (hooks.length) await Promise.all(hooks.map((cb) => cb())) 16 exports.performReactRefresh() 17 }, 16) 11 18 12 19 // Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141 … … 26 33 } 27 34 28 function validateRefreshBoundaryAndEnqueueUpdate(prevExports, nextExports) { 29 if (!predicateOnExport(prevExports, (key) => key in nextExports)) { 35 function validateRefreshBoundaryAndEnqueueUpdate(id, prevExports, nextExports) { 36 const ignoredExports = window.__getReactRefreshIgnoredExports?.({ id }) ?? [] 37 if ( 38 predicateOnExport( 39 ignoredExports, 40 prevExports, 41 (key) => key in nextExports, 42 ) !== true 43 ) { 30 44 return 'Could not Fast Refresh (export removed)' 31 45 } 32 if (!predicateOnExport(nextExports, (key) => key in prevExports)) { 46 if ( 47 predicateOnExport( 48 ignoredExports, 49 nextExports, 50 (key) => key in prevExports, 51 ) !== true 52 ) { 33 53 return 'Could not Fast Refresh (new export)' 34 54 } … … 36 56 let hasExports = false 37 57 const allExportsAreComponentsOrUnchanged = predicateOnExport( 58 ignoredExports, 38 59 nextExports, 39 60 (key, value) => { … … 43 64 }, 44 65 ) 45 if (hasExports && allExportsAreComponentsOrUnchanged ) {66 if (hasExports && allExportsAreComponentsOrUnchanged === true) { 46 67 enqueueUpdate() 47 68 } else { 48 return 'Could not Fast Refresh. Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports'69 return `Could not Fast Refresh ("${allExportsAreComponentsOrUnchanged}" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports` 49 70 } 50 71 } 51 72 52 function predicateOnExport( moduleExports, predicate) {73 function predicateOnExport(ignoredExports, moduleExports, predicate) { 53 74 for (const key in moduleExports) { 54 75 if (key === '__esModule') continue 76 if (ignoredExports.includes(key)) continue 55 77 const desc = Object.getOwnPropertyDescriptor(moduleExports, key) 56 if (desc && desc.get) return false57 if (!predicate(key, moduleExports[key])) return false78 if (desc && desc.get) return key 79 if (!predicate(key, moduleExports[key])) return key 58 80 } 59 81 return true
Note:
See TracChangeset
for help on using the changeset viewer.