universal-env
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -95,2 +95,3 @@ // {"framework" : "Rax"} | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeb", function() { return isWeb; }); | ||
@@ -100,8 +101,8 @@ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return isNode; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactNative", function() { return isReactNative; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; }); | ||
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
var isWebPure = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
var isWeb = isWebPure && !isMiniApp; | ||
var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
var isWeex = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web'; | ||
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
var isMiniApp = typeof my === 'object'; | ||
@@ -108,0 +109,0 @@ /***/ }) |
@@ -117,2 +117,3 @@ // {"framework" : "Rax"} | ||
__webpack_require__.r(__webpack_exports__); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWeb", function() { return isWeb; }); | ||
@@ -122,8 +123,8 @@ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return isNode; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReactNative", function() { return isReactNative; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMiniApp", function() { return isMiniApp; }); | ||
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
var isWebPure = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
var isWeb = isWebPure && !isMiniApp; | ||
var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
var isWeex = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web'; | ||
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
var isMiniApp = typeof my === 'object'; | ||
@@ -130,0 +131,0 @@ /***/ }) |
// {"framework" : "Rax"} | ||
!function(o){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=o();else if("function"==typeof define)define("universal-env",function(e,n,t){t.exports=o()});else{("undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this).UniversalEnv=o()}}(function(){return define("env.min",function(e){function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t,o;o={},r.m=t=[function(e,n,t){"use strict";t.r(n),t.d(n,"isWeb",function(){return o}),t.d(n,"isNode",function(){return r}),t.d(n,"isWeex",function(){return i}),t.d(n,"isReactNative",function(){return f}),t.d(n,"isMiniApp",function(){return u});var o="object"==typeof navigator&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),r="undefined"!=typeof process&&!(!process.versions||!process.versions.node),i="function"==typeof callNative||"object"==typeof WXEnvironment&&"Web"!==WXEnvironment.platform,f="undefined"!=typeof __fbBatchedBridgeConfig,u="object"==typeof my}],r.c=o,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="/",r(r.s=0)})}); | ||
!function(o){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=o();else if("function"==typeof define)define("universal-env",function(e,n,t){t.exports=o()});else{("undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:this).UniversalEnv=o()}}(function(){return define("env.min",function(e){function r(e){if(o[e])return o[e].exports;var n=o[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var t,o;o={},r.m=t=[function(e,n,t){"use strict";t.r(n),t.d(n,"isMiniApp",function(){return r}),t.d(n,"isWeb",function(){return i}),t.d(n,"isNode",function(){return f}),t.d(n,"isWeex",function(){return u}),t.d(n,"isReactNative",function(){return d});var o="object"==typeof navigator&&("Mozilla"===navigator.appCodeName||"Gecko"===navigator.product),r="object"==typeof my&&void 0!==my.getSystemInfo,i=o&&!r,f="undefined"!=typeof process&&!(!process.versions||!process.versions.node),u="function"==typeof callNative||"object"==typeof WXEnvironment&&"Web"!==WXEnvironment.platform,d="undefined"!=typeof __fbBatchedBridgeConfig}],r.c=o,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:t})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="/",r(r.s=0)})}); | ||
//# sourceMappingURL=env.min.map |
@@ -0,1 +1,2 @@ | ||
export declare const isMiniApp: boolean; | ||
export declare const isWeb: boolean; | ||
@@ -5,2 +6,1 @@ export declare const isNode: boolean; | ||
export declare const isReactNative: boolean; | ||
export declare const isMiniApp: boolean; |
"use strict"; | ||
exports.__esModule = true; | ||
exports.isMiniApp = exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = void 0; | ||
var isWeb = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
exports.isReactNative = exports.isWeex = exports.isNode = exports.isWeb = exports.isMiniApp = void 0; | ||
var isWebPure = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
exports.isMiniApp = isMiniApp; | ||
var isWeb = isWebPure && !isMiniApp; | ||
exports.isWeb = isWeb; | ||
@@ -12,4 +15,2 @@ var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
exports.isReactNative = isReactNative; | ||
var isMiniApp = typeof my === 'object'; | ||
exports.isMiniApp = isMiniApp; | ||
exports.isReactNative = isReactNative; |
{ | ||
"name": "universal-env", | ||
"author": "rax", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "BSD-3-Clause", | ||
"main": "lib/index.js", | ||
@@ -16,3 +17,3 @@ "types": "lib/index.d.ts", | ||
"lint": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx ./src", | ||
"prebuild": "npm run lint && yarn run test", | ||
"prebuild": "npm run lint && npm run test", | ||
"prepublish": "npm run build" | ||
@@ -40,3 +41,11 @@ }, | ||
"typescript": "^3.4.5" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/raxjs/universal-env" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/raxjs/universal-env/issues" | ||
}, | ||
"homepage": "https://github.com/alibaba/rax#readme" | ||
} |
@@ -1,5 +0,8 @@ | ||
# universal-env | ||
# universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env) | ||
判断和获取运行时环境 | ||
## 支持 | ||
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> | ||
## 安装 | ||
@@ -6,0 +9,0 @@ ```bash |
@@ -1,5 +0,8 @@ | ||
# universal-env | ||
# universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env) | ||
Judge runtime environment | ||
## Support | ||
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> | ||
## Install | ||
@@ -6,0 +9,0 @@ ```bash |
// eslint-disable-next-line | ||
(global as any).my = {}; | ||
(global as any).my = { | ||
getSystemInfo: () => {} | ||
}; | ||
@@ -4,0 +6,0 @@ describe('Mni app environment', (): void => { |
@@ -7,6 +7,7 @@ // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename | ||
export const isWeb: boolean = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
const isWebPure: boolean = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
export const isMiniApp: boolean = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
export const isWeb: boolean = isWebPure && !isMiniApp; | ||
export const isNode: boolean = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
export const isWeex: boolean = typeof callNative === 'function' || typeof WXEnvironment === 'object' && WXEnvironment.platform !== 'Web'; | ||
export const isReactNative: boolean = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
export const isMiniApp: boolean = typeof my === 'object'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
39547
30
0
398
0
34
0
0