Initial commit
This commit is contained in:
21
node_modules/detect-node-es/LICENSE
generated
vendored
Normal file
21
node_modules/detect-node-es/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Ilya Kantor
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
39
node_modules/detect-node-es/Readme.md
generated
vendored
Normal file
39
node_modules/detect-node-es/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
## detect-node
|
||||
> This is a fork of `detect-node`.
|
||||
|
||||
Differences:
|
||||
- uses named export {isNode}
|
||||
- has d.ts integrated
|
||||
- supports ESM
|
||||
|
||||
### Install
|
||||
|
||||
```shell
|
||||
npm install --save detect-node-es
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
```diff
|
||||
-var isNode = require('detect-node');
|
||||
+var {isNode} = require('detect-node-es');
|
||||
|
||||
if (isNode) {
|
||||
console.log("Running under Node.JS");
|
||||
} else {
|
||||
alert("Hello from browser (or whatever not-a-node env)");
|
||||
}
|
||||
```
|
||||
|
||||
The check is performed as:
|
||||
```js
|
||||
module.exports = false;
|
||||
|
||||
// Only Node.JS has a process variable that is of [[Class]] process
|
||||
try {
|
||||
module.exports = Object.prototype.toString.call(global.process) === '[object process]'
|
||||
} catch(e) {}
|
||||
|
||||
```
|
||||
|
||||
Thanks to Ingvar Stepanyan for the initial idea. This check is both **the most reliable I could find** and it does not use `process` env directly, which would cause browserify to include it into the build.
|
||||
2
node_modules/detect-node-es/es5/browser.js
generated
vendored
Normal file
2
node_modules/detect-node-es/es5/browser.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports.isNode = false;
|
||||
|
||||
4
node_modules/detect-node-es/es5/node.d.ts
generated
vendored
Normal file
4
node_modules/detect-node-es/es5/node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* returns true if the current environment is NodeJS
|
||||
*/
|
||||
export declare const isNode: boolean;
|
||||
2
node_modules/detect-node-es/es5/node.js
generated
vendored
Normal file
2
node_modules/detect-node-es/es5/node.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Only Node.JS has a process variable that is of [[Class]] process
|
||||
module.exports.isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
||||
2
node_modules/detect-node-es/esm/browser.js
generated
vendored
Normal file
2
node_modules/detect-node-es/esm/browser.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export const isNode = false;
|
||||
|
||||
2
node_modules/detect-node-es/esm/node.js
generated
vendored
Normal file
2
node_modules/detect-node-es/esm/node.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Only Node.JS has a process variable that is of [[Class]] process
|
||||
export const isNode = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';
|
||||
56
node_modules/detect-node-es/package.json
generated
vendored
Normal file
56
node_modules/detect-node-es/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_from": "detect-node-es@^1.1.0",
|
||||
"_id": "detect-node-es@1.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==",
|
||||
"_location": "/detect-node-es",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "detect-node-es@^1.1.0",
|
||||
"name": "detect-node-es",
|
||||
"escapedName": "detect-node-es",
|
||||
"rawSpec": "^1.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/use-sidecar"
|
||||
],
|
||||
"_resolved": "https://registry.npmmirror.com/detect-node-es/-/detect-node-es-1.1.0.tgz",
|
||||
"_shasum": "163acdf643330caa0b4cd7c21e7ee7755d6fa493",
|
||||
"_spec": "detect-node-es@^1.1.0",
|
||||
"_where": "/Users/hongbin9/www/botgroup.chat/node_modules/use-sidecar",
|
||||
"author": {
|
||||
"name": "Ilya Kantor"
|
||||
},
|
||||
"browser": {
|
||||
"./es5/node.js": "./es5/browser.js",
|
||||
"./esm/node.js": "./esm/browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/thekashey/detect-node/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Detect Node.JS (as opposite to browser environment). ESM modification",
|
||||
"homepage": "https://github.com/thekashey/detect-node",
|
||||
"keywords": [
|
||||
"detect",
|
||||
"node"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "es5/node.js",
|
||||
"module": "esm/node.js",
|
||||
"name": "detect-node-es",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/thekashey/detect-node.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"types": "es5/node.d.ts",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
Reference in New Issue
Block a user