From 40c38f919fc1a34013c301bb53c7db2a98ab4896 Mon Sep 17 00:00:00 2001 From: amensum Date: Wed, 10 Feb 2021 23:02:27 +0300 Subject: [PATCH 1/9] Fix Bug MessageChannel (#20756) in Node Envs --- packages/scheduler/npm/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 68a443aa1de8b..15b2c515adcbb 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,9 +1,11 @@ 'use strict'; -if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { +if (typeof process !== 'undefined') { module.exports = require('./unstable_no_dom'); -} else if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); } else { - module.exports = require('./cjs/scheduler.development.js'); + if (__DEV__) { + module.exports = require('./cjs/scheduler.development.js'); + } else { + module.exports = require('./cjs/scheduler.production.min.js'); + } } From b06a1cccdfe6343e62e756123b8f01bb2395aae0 Mon Sep 17 00:00:00 2001 From: amensum Date: Wed, 10 Feb 2021 23:23:14 +0300 Subject: [PATCH 2/9] This reverts commit 40c38f91 --- packages/scheduler/npm/index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 15b2c515adcbb..68a443aa1de8b 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,11 +1,9 @@ 'use strict'; -if (typeof process !== 'undefined') { +if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { module.exports = require('./unstable_no_dom'); +} else if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); } else { - if (__DEV__) { - module.exports = require('./cjs/scheduler.development.js'); - } else { - module.exports = require('./cjs/scheduler.production.min.js'); - } + module.exports = require('./cjs/scheduler.development.js'); } From 10e587c508d3e4ff2d4bfdd1cb16ec9877fea72d Mon Sep 17 00:00:00 2001 From: amensum Date: Thu, 11 Feb 2021 00:50:07 +0300 Subject: [PATCH 3/9] Fix Bug MessageChannel in Node Envs (issue #20756) --- packages/scheduler/npm/index.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 68a443aa1de8b..94b5e20a71267 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,9 +1,24 @@ 'use strict'; -if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { - module.exports = require('./unstable_no_dom'); -} else if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); +// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' +var canUseDom = !!( + typeof window !== 'undefined' && + typeof window.document !== 'undefined' && + typeof window.document.createElement !== 'undefined' +); + +// Node environment has cycled global reference +var isCycledGlobal = !!( + typeof global !== 'undefined' && + global.global === global +); + +if (canUseDom && !isCycledGlobal) { + if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); + } else { + module.exports = require('./cjs/scheduler.development.js'); + } } else { - module.exports = require('./cjs/scheduler.development.js'); + module.exports = require('./unstable_no_dom'); } From e46d711d526d9588b2207d5e6fbe36177cba0552 Mon Sep 17 00:00:00 2001 From: amensum Date: Thu, 11 Feb 2021 00:50:07 +0300 Subject: [PATCH 4/9] This reverts commit 10e587c5 --- packages/scheduler/npm/index.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 94b5e20a71267..68a443aa1de8b 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,24 +1,9 @@ 'use strict'; -// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' -var canUseDom = !!( - typeof window !== 'undefined' && - typeof window.document !== 'undefined' && - typeof window.document.createElement !== 'undefined' -); - -// Node environment has cycled global reference -var isCycledGlobal = !!( - typeof global !== 'undefined' && - global.global === global -); - -if (canUseDom && !isCycledGlobal) { - if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); - } else { - module.exports = require('./cjs/scheduler.development.js'); - } -} else { +if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { module.exports = require('./unstable_no_dom'); +} else if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); +} else { + module.exports = require('./cjs/scheduler.development.js'); } From a47a9797f2ece869dc7a2fe20bcc7255679f999e Mon Sep 17 00:00:00 2001 From: amensum Date: Fri, 12 Feb 2021 02:56:48 +0300 Subject: [PATCH 5/9] Fix Bug MessageChannel in Node Envs (issue #20756) --- packages/scheduler/npm/index.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 68a443aa1de8b..fa0bf83aed1f3 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,9 +1,24 @@ 'use strict'; -if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { - module.exports = require('./unstable_no_dom'); -} else if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); +// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' +var canUseDom = !!( + typeof window !== 'undefined' && + typeof window.document !== 'undefined' && + typeof window.document.createElement !== 'undefined' +); + +// Checks if this is global space +var isThisGlobal = !!( + typeof globalThis !== 'undefined' && + globalThis === this +); + +if (canUseDom && isThisGlobal) { + if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); + } else { + module.exports = require('./cjs/scheduler.development.js'); + } } else { - module.exports = require('./cjs/scheduler.development.js'); + module.exports = require('./unstable_no_dom'); } From f5197286c647f2568ed3d03e81b57ef86eab24c4 Mon Sep 17 00:00:00 2001 From: amensum Date: Fri, 12 Feb 2021 03:12:36 +0300 Subject: [PATCH 6/9] This reverts commit a47a9797 --- packages/scheduler/npm/index.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index fa0bf83aed1f3..68a443aa1de8b 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,24 +1,9 @@ 'use strict'; -// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' -var canUseDom = !!( - typeof window !== 'undefined' && - typeof window.document !== 'undefined' && - typeof window.document.createElement !== 'undefined' -); - -// Checks if this is global space -var isThisGlobal = !!( - typeof globalThis !== 'undefined' && - globalThis === this -); - -if (canUseDom && isThisGlobal) { - if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); - } else { - module.exports = require('./cjs/scheduler.development.js'); - } -} else { +if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { module.exports = require('./unstable_no_dom'); +} else if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); +} else { + module.exports = require('./cjs/scheduler.development.js'); } From c1394eac82b116164ce44e1f32147fb72c6da92a Mon Sep 17 00:00:00 2001 From: amensum Date: Fri, 12 Feb 2021 03:20:34 +0300 Subject: [PATCH 7/9] Fix Bug MessageChannel in Node Envs (issue #20756) --- packages/scheduler/npm/index.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 68a443aa1de8b..2120ca4f8474b 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,9 +1,22 @@ 'use strict'; -if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { - module.exports = require('./unstable_no_dom'); -} else if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); +// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' +var canUseDom = !!( + typeof window !== 'undefined' && + typeof window.document !== 'undefined' && + typeof window.document.createElement !== 'undefined' +); + +// Checks if this is global space +// eslint-disable-next-line no-undef +var isThisGlobal = !!(typeof globalThis !== 'undefined' && globalThis === this); + +if (canUseDom && isThisGlobal) { + if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); + } else { + module.exports = require('./cjs/scheduler.development.js'); + } } else { - module.exports = require('./cjs/scheduler.development.js'); + module.exports = require('./unstable_no_dom'); } From 0c6db5f6d97da62925c83a03041ead145c91ab12 Mon Sep 17 00:00:00 2001 From: amensum Date: Fri, 12 Feb 2021 03:44:09 +0300 Subject: [PATCH 8/9] This reverts commit c1394eac --- packages/scheduler/npm/index.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 2120ca4f8474b..68a443aa1de8b 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,22 +1,9 @@ 'use strict'; -// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' -var canUseDom = !!( - typeof window !== 'undefined' && - typeof window.document !== 'undefined' && - typeof window.document.createElement !== 'undefined' -); - -// Checks if this is global space -// eslint-disable-next-line no-undef -var isThisGlobal = !!(typeof globalThis !== 'undefined' && globalThis === this); - -if (canUseDom && isThisGlobal) { - if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); - } else { - module.exports = require('./cjs/scheduler.development.js'); - } -} else { +if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { module.exports = require('./unstable_no_dom'); +} else if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); +} else { + module.exports = require('./cjs/scheduler.development.js'); } From cda9108590c15e537862e8b1d4b09953ac37e689 Mon Sep 17 00:00:00 2001 From: amensum Date: Fri, 12 Feb 2021 03:45:03 +0300 Subject: [PATCH 9/9] Fix Bug MessageChannel in Node Envs (issue #20756) --- packages/scheduler/npm/index.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/scheduler/npm/index.js b/packages/scheduler/npm/index.js index 68a443aa1de8b..3a7a8b897e6ba 100644 --- a/packages/scheduler/npm/index.js +++ b/packages/scheduler/npm/index.js @@ -1,9 +1,24 @@ 'use strict'; -if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { - module.exports = require('./unstable_no_dom'); -} else if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/scheduler.production.min.js'); +// Duplicated from 'react/packages/shared/ExecutionEnvironment.js' +var canUseDom = !!( + typeof window !== 'undefined' && + typeof window.document !== 'undefined' && + typeof window.document.createElement !== 'undefined' +); + +// Checks if this is global space to catch +// execution in node environments and use 'unstable_no_dom' +// +// eslint-disable-next-line no-undef +var isThisGlobal = !!(typeof globalThis !== 'undefined' && globalThis === this); + +if (canUseDom && isThisGlobal) { + if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/scheduler.production.min.js'); + } else { + module.exports = require('./cjs/scheduler.development.js'); + } } else { - module.exports = require('./cjs/scheduler.development.js'); + module.exports = require('./unstable_no_dom'); }