New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dekkai/env

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dekkai/env - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

15

build/dist/mod.js

@@ -39,3 +39,3 @@ /**

try {
import(`${null}`).catch(() => false);
import(/* webpackIgnore: true */ `${null}`).catch(() => false);
return true;

@@ -58,2 +58,4 @@ }

}
// eslint-disable-next-line no-new-func
const requireFunc = new Function('mod', 'return require(mod)');
/**

@@ -65,9 +67,10 @@ * Detects the environment and loads a module using either `require` or `import`.

if (kSupportsDynamicImport) {
return await import(mod.toString());
return await import(/* webpackIgnore: true */ mod.toString());
}
else if (isNodeJS()) {
return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// eslint-disable-next-line camelcase
typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
typeof require === 'function' && require(mod.toString()); // eslint-disable-line
// return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// // eslint-disable-next-line camelcase
// typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
// typeof require === 'function' && require(mod.toString()); // eslint-disable-line
return requireFunc(mod);
}

@@ -74,0 +77,0 @@ // not supported, a dynamic loader could be created for browser environments here, all modern browsers support

@@ -9,3 +9,3 @@ import { isNodeJS } from './node.js';

try {
import(`${null}`).catch(() => false);
import(/* webpackIgnore: true */ `${null}`).catch(() => false);
return true;

@@ -28,2 +28,4 @@ }

}
// eslint-disable-next-line no-new-func
const requireFunc = new Function('mod', 'return require(mod)');
/**

@@ -35,9 +37,10 @@ * Detects the environment and loads a module using either `require` or `import`.

if (kSupportsDynamicImport) {
return await import(mod.toString());
return await import(/* webpackIgnore: true */ mod.toString());
}
else if (isNodeJS()) {
return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// eslint-disable-next-line camelcase
typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
typeof require === 'function' && require(mod.toString()); // eslint-disable-line
// return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// // eslint-disable-next-line camelcase
// typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
// typeof require === 'function' && require(mod.toString()); // eslint-disable-line
return requireFunc(mod);
}

@@ -44,0 +47,0 @@ // not supported, a dynamic loader could be created for browser environments here, all modern browsers support

4

package.json
{
"name": "@dekkai/env",
"version": "1.0.1",
"version": "1.1.0",
"description": "Utility methods to detect runtimes and load modules dynamically.",

@@ -33,3 +33,3 @@ "main": "build/lib/mod.js",

"test:browser": "karma start --single-run --browsers ChromeHeadless karma.conf.cjs",
"test:deno": "deno run --allow-read --allow-net spec/env/deno.suite.js",
"test:deno": "deno run --allow-read --allow-net --location 'http://localhost:0' spec/env/deno.suite.js",
"lint": "eslint . --ext .js,.ts,.jsx,.tsx",

@@ -36,0 +36,0 @@ "prepack": "run-s clean test lint",

@@ -9,3 +9,3 @@ import {isNodeJS} from './node';

try {
import(`${null}`).catch(() => false);
import(/* webpackIgnore: true */ `${null}`).catch(() => false);
return true;

@@ -38,2 +38,5 @@ } catch {

// eslint-disable-next-line no-new-func
const requireFunc = new Function('mod', 'return require(mod)');
/**

@@ -45,8 +48,9 @@ * Detects the environment and loads a module using either `require` or `import`.

if (kSupportsDynamicImport) {
return await import(mod.toString());
return await import(/* webpackIgnore: true */ mod.toString());
} else if (isNodeJS()) {
return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// eslint-disable-next-line camelcase
typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
typeof require === 'function' && require(mod.toString()); // eslint-disable-line
// return typeof module !== 'undefined' && typeof module.require === 'function' && module.require(mod.toString()) ||
// // eslint-disable-next-line camelcase
// typeof __non_webpack_require__ === 'function' && __non_webpack_require__(mod.toString()) ||
// typeof require === 'function' && require(mod.toString()); // eslint-disable-line
return requireFunc(mod);
}

@@ -53,0 +57,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc