From 7065605245ad66fd965d01b9133cd05e75d2268c Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 1 Feb 2019 01:07:56 +0700 Subject: [PATCH] Do the Node.js check ourselves --- package.json | 1 - source/lib/utils/infer-label.ts | 4 ++-- source/lib/utils/node/is-node.ts | 2 ++ source/types.d.ts | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) create mode 100644 source/lib/utils/node/is-node.ts delete mode 100644 source/types.d.ts diff --git a/package.json b/package.json index 6a93fad..648f6fe 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "codecov": "^3.1.0", "del-cli": "^1.1.0", "dot-prop": "^4.2.0", - "is-node": "^1.0.2", "license-webpack-plugin": "^2.0.2", "lodash.isequal": "^4.5.0", "nyc": "^13.1.0", diff --git a/source/lib/utils/infer-label.ts b/source/lib/utils/infer-label.ts index 974d3d4..69f273e 100644 --- a/source/lib/utils/infer-label.ts +++ b/source/lib/utils/infer-label.ts @@ -1,7 +1,7 @@ -import lazyFS from './node/fs'; import {CallSite} from 'callsites'; -import * as isNode from 'is-node'; +import lazyFS from './node/fs'; import isValidIdentifier from './is-valid-identifier'; +import isNode from './node/is-node'; // Regex to extract the label out of the `ow` function call const labelRegex = /^.*?\((.*?)[,)]/; diff --git a/source/lib/utils/node/is-node.ts b/source/lib/utils/node/is-node.ts new file mode 100644 index 0000000..105a743 --- /dev/null +++ b/source/lib/utils/node/is-node.ts @@ -0,0 +1,2 @@ +// tslint:disable-next-line strict-type-predicates no-typeof-undefined +export default Boolean(typeof process !== 'undefined' && process.versions && process.versions.node); diff --git a/source/types.d.ts b/source/types.d.ts deleted file mode 100644 index 260fd66..0000000 --- a/source/types.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare module 'is-valid-identifier'; -declare module 'is-node';