@realm.io/common
Advanced tools
+44
-0
@@ -121,2 +121,45 @@ 'use strict'; | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Copyright 2022 Realm Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exports a globalThis which is polyfilled for iOS 11/12 | ||
| // From https://github.com/zloirock/core-js/blob/master/packages/core-js/internals/global.js | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const check = function (it) { | ||
| return it && it.Math == Math && it; | ||
| }; | ||
| // eslint-disable-next-line no-restricted-globals | ||
| const safeGlobalThis = | ||
| // eslint-disable-next-line no-restricted-globals | ||
| check(typeof globalThis == "object" && globalThis) || | ||
| check(typeof window == "object" && window) || | ||
| // eslint-disable-next-line no-restricted-globals -- safe | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `self` | ||
| check(typeof self == "object" && self) || | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `global` | ||
| check(typeof global == "object" && global) || | ||
| // eslint-disable-next-line no-new-func -- fallback | ||
| (function () { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `this` | ||
| return this; | ||
| })() || | ||
| Function("return this")(); | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exported for unit testing | ||
@@ -143,2 +186,3 @@ const isDevelopmentModeImpl = () => { | ||
| exports.isDevelopmentModeImpl = isDevelopmentModeImpl; | ||
| exports.safeGlobalThis = safeGlobalThis; | ||
| exports.symbols = symbols; |
+3
-1
@@ -46,2 +46,4 @@ /** | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, symbols_d as symbols }; | ||
| declare const safeGlobalThis: typeof globalThis; | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, safeGlobalThis, symbols_d as symbols }; |
@@ -121,2 +121,45 @@ 'use strict'; | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Copyright 2022 Realm Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exports a globalThis which is polyfilled for iOS 11/12 | ||
| // From https://github.com/zloirock/core-js/blob/master/packages/core-js/internals/global.js | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const check = function (it) { | ||
| return it && it.Math == Math && it; | ||
| }; | ||
| // eslint-disable-next-line no-restricted-globals | ||
| const safeGlobalThis = | ||
| // eslint-disable-next-line no-restricted-globals | ||
| check(typeof globalThis == "object" && globalThis) || | ||
| check(typeof window == "object" && window) || | ||
| // eslint-disable-next-line no-restricted-globals -- safe | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `self` | ||
| check(typeof self == "object" && self) || | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `global` | ||
| check(typeof global == "object" && global) || | ||
| // eslint-disable-next-line no-new-func -- fallback | ||
| (function () { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `this` | ||
| return this; | ||
| })() || | ||
| Function("return this")(); | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // React/React Native set a global __DEV__ variable when running in dev mode | ||
@@ -127,2 +170,3 @@ setIsDevelopmentMode(typeof __DEV__ !== "undefined" && __DEV__); | ||
| exports.handleDeprecatedPositionalArgs = handleDeprecatedPositionalArgs; | ||
| exports.safeGlobalThis = safeGlobalThis; | ||
| exports.symbols = symbols; |
@@ -117,5 +117,48 @@ //////////////////////////////////////////////////////////////////////////// | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Copyright 2022 Realm Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exports a globalThis which is polyfilled for iOS 11/12 | ||
| // From https://github.com/zloirock/core-js/blob/master/packages/core-js/internals/global.js | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const check = function (it) { | ||
| return it && it.Math == Math && it; | ||
| }; | ||
| // eslint-disable-next-line no-restricted-globals | ||
| const safeGlobalThis = | ||
| // eslint-disable-next-line no-restricted-globals | ||
| check(typeof globalThis == "object" && globalThis) || | ||
| check(typeof window == "object" && window) || | ||
| // eslint-disable-next-line no-restricted-globals -- safe | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `self` | ||
| check(typeof self == "object" && self) || | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `global` | ||
| check(typeof global == "object" && global) || | ||
| // eslint-disable-next-line no-new-func -- fallback | ||
| (function () { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `this` | ||
| return this; | ||
| })() || | ||
| Function("return this")(); | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // React/React Native set a global __DEV__ variable when running in dev mode | ||
| setIsDevelopmentMode(typeof __DEV__ !== "undefined" && __DEV__); | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, symbols }; | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, safeGlobalThis, symbols }; |
+44
-1
@@ -117,2 +117,45 @@ //////////////////////////////////////////////////////////////////////////// | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // | ||
| // Copyright 2022 Realm Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exports a globalThis which is polyfilled for iOS 11/12 | ||
| // From https://github.com/zloirock/core-js/blob/master/packages/core-js/internals/global.js | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const check = function (it) { | ||
| return it && it.Math == Math && it; | ||
| }; | ||
| // eslint-disable-next-line no-restricted-globals | ||
| const safeGlobalThis = | ||
| // eslint-disable-next-line no-restricted-globals | ||
| check(typeof globalThis == "object" && globalThis) || | ||
| check(typeof window == "object" && window) || | ||
| // eslint-disable-next-line no-restricted-globals -- safe | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `self` | ||
| check(typeof self == "object" && self) || | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `global` | ||
| check(typeof global == "object" && global) || | ||
| // eslint-disable-next-line no-new-func -- fallback | ||
| (function () { | ||
| // eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| // @ts-ignore allow `this` | ||
| return this; | ||
| })() || | ||
| Function("return this")(); | ||
| //////////////////////////////////////////////////////////////////////////// | ||
| // Exported for unit testing | ||
@@ -136,2 +179,2 @@ const isDevelopmentModeImpl = () => { | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, isDevelopmentModeImpl, symbols }; | ||
| export { deprecationWarning, handleDeprecatedPositionalArgs, isDevelopmentModeImpl, safeGlobalThis, symbols }; |
+1
-2
| { | ||
| "name": "@realm.io/common", | ||
| "version": "0.1.2", | ||
| "version": "0.1.3", | ||
| "description": "Cross-product common code used by Realm", | ||
@@ -49,2 +49,1 @@ "main": "./dist/bundle.cjs.js", | ||
| } | ||
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
35871
26.91%713
31.55%4
300%