Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/@vitejs/plugin-react/dist/refreshUtils.js

    rd565449 r0c6b92a  
    88
    99/* eslint-disable no-undef */
    10 const enqueueUpdate = debounce(exports.performReactRefresh, 16)
     10const hooks = []
     11window.__registerBeforePerformReactRefresh = (cb) => {
     12  hooks.push(cb)
     13}
     14const enqueueUpdate = debounce(async () => {
     15  if (hooks.length) await Promise.all(hooks.map((cb) => cb()))
     16  exports.performReactRefresh()
     17}, 16)
    1118
    1219// Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141
     
    2633}
    2734
    28 function validateRefreshBoundaryAndEnqueueUpdate(prevExports, nextExports) {
    29   if (!predicateOnExport(prevExports, (key) => key in nextExports)) {
     35function 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  ) {
    3044    return 'Could not Fast Refresh (export removed)'
    3145  }
    32   if (!predicateOnExport(nextExports, (key) => key in prevExports)) {
     46  if (
     47    predicateOnExport(
     48      ignoredExports,
     49      nextExports,
     50      (key) => key in prevExports,
     51    ) !== true
     52  ) {
    3353    return 'Could not Fast Refresh (new export)'
    3454  }
     
    3656  let hasExports = false
    3757  const allExportsAreComponentsOrUnchanged = predicateOnExport(
     58    ignoredExports,
    3859    nextExports,
    3960    (key, value) => {
     
    4364    },
    4465  )
    45   if (hasExports && allExportsAreComponentsOrUnchanged) {
     66  if (hasExports && allExportsAreComponentsOrUnchanged === true) {
    4667    enqueueUpdate()
    4768  } 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`
    4970  }
    5071}
    5172
    52 function predicateOnExport(moduleExports, predicate) {
     73function predicateOnExport(ignoredExports, moduleExports, predicate) {
    5374  for (const key in moduleExports) {
    5475    if (key === '__esModule') continue
     76    if (ignoredExports.includes(key)) continue
    5577    const desc = Object.getOwnPropertyDescriptor(moduleExports, key)
    56     if (desc && desc.get) return false
    57     if (!predicate(key, moduleExports[key])) return false
     78    if (desc && desc.get) return key
     79    if (!predicate(key, moduleExports[key])) return key
    5880  }
    5981  return true
Note: See TracChangeset for help on using the changeset viewer.