Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

has-dynamic-import

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-dynamic-import - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

browser-syntax.d.ts

8

browser.js

@@ -7,5 +7,7 @@ 'use strict';

var pFalse = $then && Promise.resolve(false);
/** @type {() => false} */
var thunkFalse = function () {
return false;
};
/** @type {() => true} */
var thunkTrue = function () {

@@ -15,6 +17,10 @@ return true;

module.exports = function hasFunctionality() {
/** @type {() => PromiseLike<boolean>} */
module.exports = function hasDynamicImport() {
if (!$then) {
return {
__proto__: null,
// @ts-expect-error ts(2322) TODO: fixme
then: function (resolve) {
// @ts-expect-error ts(2723) TODO: fixme
resolve(false);

@@ -21,0 +27,0 @@ }

@@ -8,2 +8,17 @@ # Changelog

## [v2.1.0](https://github.com/inspect-js/has-dynamic-import/compare/v2.0.1...v2.1.0) - 2024-01-12
### Commits
- [meta] use `npmignore` to autogenerate an npmignore file [`16fda28`](https://github.com/inspect-js/has-dynamic-import/commit/16fda2832e3ea59b72145a464740d93c6f9e4341)
- [New] add inline jsdoc types, for TS [`4d07733`](https://github.com/inspect-js/has-dynamic-import/commit/4d077337e2a5d6897f93363794916a29a440e017)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`63fe5e3`](https://github.com/inspect-js/has-dynamic-import/commit/63fe5e33ddcc22783e226ca35fa792dfe373dd36)
- [actions] update rebase action to use reusable workflow [`5bc0894`](https://github.com/inspect-js/has-dynamic-import/commit/5bc0894224a711c4c7e6b68771d95984ccba513f)
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `semver`, `tape` [`201283d`](https://github.com/inspect-js/has-dynamic-import/commit/201283de6b6314fa39254d241d4e3e975702ad39)
- [Deps] update `call-bind`, `get-intrinsic` [`4a5bed0`](https://github.com/inspect-js/has-dynamic-import/commit/4a5bed0c8a7c50ab7a0e9dab36f43f4b462dbe55)
- [meta] add missing `engines.node` [`b544707`](https://github.com/inspect-js/has-dynamic-import/commit/b544707aa19b50cd648df0b8721574c19bce0566)
- [Robustness] make promiselikes into null objects [`ffded66`](https://github.com/inspect-js/has-dynamic-import/commit/ffded665cfc52b0a10798a492b616cf2fd705507)
- [Deps] update `get-intrinsic` [`dc65726`](https://github.com/inspect-js/has-dynamic-import/commit/dc65726bd08f31de40220c680256464dd253eba9)
- [meta] add `sideEffects` flag [`512e0fd`](https://github.com/inspect-js/has-dynamic-import/commit/512e0fdd84b6c2846fe843597402f61793953b4d)
## [v2.0.1](https://github.com/inspect-js/has-dynamic-import/compare/v2.0.0...v2.0.1) - 2021-12-12

@@ -10,0 +25,0 @@

'use strict';
/** @type {() => Promise<void>} */
module.exports = function () {
// @ts-expect-error ts(2307) this is a data URI
const promise = import('data:text/javascript,');

@@ -5,0 +7,0 @@ promise.catch(() => {});

11

index.js

@@ -9,7 +9,9 @@ 'use strict';

var $PromiseResolve = GetIntrinsic('%Promise.resolve%', true);
var $resolve = $Promise && $PromiseResolve && callBind($PromiseResolve, $Promise);
var $resolve = $Promise && $PromiseResolve && $then && callBind($PromiseResolve, $Promise);
/** @type {() => false} */
var thunkFalse = function () {
return false;
};
/** @type {() => true} */
var thunkTrue = function () {

@@ -19,5 +21,9 @@ return true;

/** @type {() => PromiseLike<boolean>} */
module.exports = function hasDynamicImport() {
if (!$then) {
var p = {
/** @type {PromiseLike<boolean>} */
return {
__proto__: null,
// @ts-expect-error ts(2322) TODO: fixme
then: function (resolve) { // eslint-disable-line consistent-return

@@ -33,3 +39,2 @@ if (typeof resolve === 'function') {

};
return p;
}

@@ -36,0 +41,0 @@

{
"name": "has-dynamic-import",
"version": "2.0.1",
"version": "2.1.0",
"description": "Does the current environment have `import()` support?",

@@ -27,6 +27,12 @@ "main": "index.js",

},
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated && npm run emit-types",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"lint": "eslint --ext=.js,.mjs .",
"tsc": "tsc -p .",
"postlint": "npm run tsc",
"preemit-types": "rm -f *.ts *.ts.map test/*.ts test/*.ts.map",
"emit-types": "npm run tsc -- --noEmit false --emitDeclarationOnly",
"pretest": "npm run lint",

@@ -62,10 +68,17 @@ "tests-only": "nyc tape 'test/**/*.js'",

"devDependencies": {
"@ljharb/eslint-config": "^20.0.0",
"aud": "^1.1.5",
"auto-changelog": "^2.3.0",
"eslint": "^8.4.1",
"@ljharb/eslint-config": "^21.1.0",
"@types/call-bind": "^1.0.5",
"@types/node": "^20.11.0",
"@types/semver": "^7.5.6",
"@types/tape": "^5.6.4",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"semver": "^6.3.0",
"tape": "^5.3.2"
"semver": "^6.3.1",
"tape": "^5.7.2",
"typescript": "^5.4.0-dev.20240112"
},

@@ -84,8 +97,18 @@ "directories": {

"dependencies": {
"call-bind": "^1.0.2",
"get-intrinsic": "^1.1.1"
"call-bind": "^1.0.5",
"get-intrinsic": "^1.2.2"
},
"testling": {
"files": "test/index.js"
},
"publishConfig": {
"ignore": [
".github/workflows",
"!*.d.ts",
"!*.d.ts.map"
]
},
"engines": {
"node": ">= 0.4"
}
}

@@ -7,4 +7,3 @@ 'use strict';

var isNode = !isBrowser && typeof process !== 'undefined';
// eslint-disable-next-line global-require
var spawnSync = isNode && require('child_process').spawnSync;
var spawnSync = isNode && require('child_process').spawnSync; // eslint-disable-line global-require

@@ -36,4 +35,5 @@ var hasFullSupport = require('../');

t.test('experimental warning', { skip: !spawnSync || process.env.RECURSION }, function (st) {
t.test('experimental warning', { skip: !spawnSync || !!process.env.RECURSION }, function (st) {
st.plan(1);
// @ts-expect-error ts(2349) TS can't narrow based on tape's `skip`
var res = spawnSync('node', ['test'], {

@@ -40,0 +40,0 @@ env: { PATH: process.env.PATH, RECURSION: 'recursion' }

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