step-node-agent 3.19.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/body-parser/HISTORY.md +6 -0
- package/node_modules/body-parser/README.md +1 -1
- package/node_modules/body-parser/index.js +8 -9
- package/node_modules/body-parser/package.json +8 -8
- package/node_modules/capture-stack-trace/license +2 -1
- package/node_modules/capture-stack-trace/package.json +28 -27
- package/node_modules/capture-stack-trace/readme.md +1 -5
- package/node_modules/duplexer3/license +10 -0
- package/node_modules/duplexer3/package.json +25 -26
- package/node_modules/duplexer3/{README.md → readme.md} +25 -41
- package/node_modules/express/History.md +9 -0
- package/node_modules/express/Readme.md +2 -2
- package/node_modules/express/lib/router/route.js +8 -8
- package/node_modules/express/package.json +7 -7
- package/node_modules/get-intrinsic/.eslintrc +2 -8
- package/node_modules/get-intrinsic/.nycrc +0 -4
- package/node_modules/get-intrinsic/CHANGELOG.md +34 -0
- package/node_modules/get-intrinsic/README.md +7 -1
- package/node_modules/get-intrinsic/index.js +4 -0
- package/node_modules/get-intrinsic/package.json +25 -12
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +25 -11
- package/node_modules/glob/common.js +2 -0
- package/node_modules/glob/glob.js +4 -1
- package/node_modules/glob/package.json +5 -2
- package/node_modules/glob/sync.js +6 -3
- package/node_modules/is-callable/.editorconfig +5 -0
- package/node_modules/is-callable/.eslintrc +0 -11
- package/node_modules/is-callable/CHANGELOG.md +50 -0
- package/node_modules/is-callable/README.md +16 -0
- package/node_modules/is-callable/index.js +35 -8
- package/node_modules/is-callable/package.json +27 -13
- package/node_modules/is-callable/test/index.js +86 -12
- package/node_modules/is-core-module/CHANGELOG.md +7 -0
- package/node_modules/is-core-module/core.json +1 -1
- package/node_modules/is-core-module/package.json +1 -1
- package/node_modules/is-core-module/test/index.js +1 -1
- package/node_modules/minimist/.eslintrc +54 -0
- package/node_modules/minimist/.github/FUNDING.yml +12 -0
- package/node_modules/minimist/.nycrc +14 -0
- package/node_modules/minimist/CHANGELOG.md +212 -0
- package/node_modules/minimist/{readme.markdown → README.md} +20 -1
- package/node_modules/minimist/package.json +39 -9
- package/node_modules/object-inspect/CHANGELOG.md +18 -0
- package/node_modules/object-inspect/index.js +7 -6
- package/node_modules/object-inspect/package-support.json +20 -0
- package/node_modules/object-inspect/package.json +20 -10
- package/node_modules/object-inspect/test/err.js +3 -3
- package/node_modules/object-inspect/test/has.js +6 -25
- package/node_modules/object-inspect/test/inspect.js +37 -0
- package/node_modules/object-inspect/test/values.js +3 -3
- package/node_modules/psl/.env +0 -0
- package/node_modules/psl/README.md +1 -5
- package/node_modules/psl/data/rules.json +718 -176
- package/node_modules/psl/dist/psl.js +720 -178
- package/node_modules/psl/dist/psl.min.js +1 -1
- package/node_modules/psl/package.json +16 -17
- package/node_modules/qs/.editorconfig +3 -0
- package/node_modules/qs/.eslintrc +5 -5
- package/node_modules/qs/CHANGELOG.md +158 -0
- package/node_modules/qs/README.md +3 -1
- package/node_modules/qs/dist/qs.js +19 -9
- package/node_modules/qs/lib/stringify.js +12 -3
- package/node_modules/qs/package.json +16 -12
- package/node_modules/qs/test/parse.js +14 -0
- package/node_modules/qs/test/stringify.js +54 -10
- package/node_modules/resolve/lib/async.js +1 -1
- package/node_modules/resolve/lib/core.json +1 -0
- package/node_modules/resolve/lib/sync.js +1 -1
- package/node_modules/resolve/package.json +14 -5
- package/node_modules/resolve/test/core.js +8 -1
- package/node_modules/resolve/test/resolver/false_main/index.js +0 -0
- package/node_modules/resolve/test/resolver/false_main/package.json +4 -0
- package/node_modules/resolve/test/resolver.js +49 -0
- package/node_modules/resolve/test/resolver_sync.js +82 -1
- package/node_modules/underscore/amd/_set.js +21 -0
- package/node_modules/underscore/amd/_setup.js +1 -1
- package/node_modules/underscore/amd/set.js +15 -0
- package/node_modules/underscore/cjs/_set.js +21 -0
- package/node_modules/underscore/cjs/_setup.js +1 -1
- package/node_modules/underscore/cjs/set.js +15 -0
- package/node_modules/underscore/modules/_setup.js +1 -1
- package/node_modules/underscore/modules/index.js +1 -1
- package/node_modules/underscore/modules/package.json +1 -3
- package/node_modules/underscore/package.json +14 -11
- package/node_modules/underscore/underscore-esm-min.js +2 -2
- package/node_modules/underscore/underscore-esm.js +2 -2
- package/node_modules/underscore/underscore-min.js +2 -2
- package/node_modules/underscore/underscore-node-f.cjs +2 -2
- package/node_modules/underscore/underscore-node.cjs +1 -1
- package/node_modules/underscore/underscore-node.mjs +1 -1
- package/node_modules/underscore/underscore-umd-min.js +2 -2
- package/node_modules/underscore/underscore-umd.js +2 -2
- package/node_modules/underscore/underscore.js +2 -2
- package/package.json +1 -1
- package/node_modules/duplexer3/LICENSE.md +0 -26
- package/node_modules/get-intrinsic/.eslintignore +0 -1
- package/node_modules/is-callable/.eslintignore +0 -1
- package/node_modules/is-callable/.istanbul.yml +0 -47
- package/node_modules/minimist/.travis.yml +0 -8
- package/node_modules/object-inspect/.eslintignore +0 -1
- package/node_modules/path-exists/index.js +0 -17
- package/node_modules/path-exists/license +0 -21
- package/node_modules/path-exists/package.json +0 -40
- package/node_modules/path-exists/readme.md +0 -50
- package/node_modules/resolve/appveyor.yml +0 -76
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-intrinsic",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Get and robustly cache all JS language-level intrinsics at first require time",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"./package.json": "./package.json"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
17
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
18
|
+
"prepublishOnly": "safe-publish-latest",
|
|
16
19
|
"prelint": "evalmd README.md",
|
|
17
20
|
"lint": "eslint --ext=.js,.mjs .",
|
|
18
21
|
"pretest": "npm run lint",
|
|
@@ -45,22 +48,24 @@
|
|
|
45
48
|
},
|
|
46
49
|
"homepage": "https://github.com/ljharb/get-intrinsic#readme",
|
|
47
50
|
"devDependencies": {
|
|
48
|
-
"@ljharb/eslint-config": "^
|
|
49
|
-
"aud": "^
|
|
50
|
-
"auto-changelog": "^2.
|
|
51
|
+
"@ljharb/eslint-config": "^21.0.0",
|
|
52
|
+
"aud": "^2.0.0",
|
|
53
|
+
"auto-changelog": "^2.4.0",
|
|
51
54
|
"call-bind": "^1.0.2",
|
|
52
|
-
"es-abstract": "^1.
|
|
53
|
-
"es-value-fixtures": "^1.
|
|
54
|
-
"eslint": "
|
|
55
|
+
"es-abstract": "^1.20.2",
|
|
56
|
+
"es-value-fixtures": "^1.4.2",
|
|
57
|
+
"eslint": "=8.8.0",
|
|
55
58
|
"evalmd": "^0.0.19",
|
|
56
|
-
"
|
|
57
|
-
"has-bigints": "^1.0.1",
|
|
59
|
+
"for-each": "^0.3.3",
|
|
58
60
|
"make-async-function": "^1.0.0",
|
|
59
61
|
"make-async-generator-function": "^1.0.0",
|
|
60
62
|
"make-generator-function": "^2.0.0",
|
|
63
|
+
"mock-property": "^1.0.0",
|
|
64
|
+
"npmignore": "^0.3.0",
|
|
61
65
|
"nyc": "^10.3.2",
|
|
62
|
-
"object-inspect": "^1.
|
|
63
|
-
"
|
|
66
|
+
"object-inspect": "^1.12.2",
|
|
67
|
+
"safe-publish-latest": "^2.0.0",
|
|
68
|
+
"tape": "^5.6.0"
|
|
64
69
|
},
|
|
65
70
|
"auto-changelog": {
|
|
66
71
|
"output": "CHANGELOG.md",
|
|
@@ -73,6 +78,14 @@
|
|
|
73
78
|
"dependencies": {
|
|
74
79
|
"function-bind": "^1.1.1",
|
|
75
80
|
"has": "^1.0.3",
|
|
76
|
-
"has-symbols": "^1.0.
|
|
81
|
+
"has-symbols": "^1.0.3"
|
|
82
|
+
},
|
|
83
|
+
"testling": {
|
|
84
|
+
"files": "test/GetIntrinsic.js"
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"ignore": [
|
|
88
|
+
".github/workflows"
|
|
89
|
+
]
|
|
77
90
|
}
|
|
78
91
|
}
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
var GetIntrinsic = require('../');
|
|
4
4
|
|
|
5
5
|
var test = require('tape');
|
|
6
|
-
var forEach = require('
|
|
6
|
+
var forEach = require('for-each');
|
|
7
7
|
var debug = require('object-inspect');
|
|
8
8
|
var generatorFns = require('make-generator-function')();
|
|
9
9
|
var asyncFns = require('make-async-function').list();
|
|
10
10
|
var asyncGenFns = require('make-async-generator-function')();
|
|
11
|
+
var mockProperty = require('mock-property');
|
|
11
12
|
|
|
12
13
|
var callBound = require('call-bind/callBound');
|
|
13
14
|
var v = require('es-value-fixtures');
|
|
14
15
|
var $gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');
|
|
15
|
-
var
|
|
16
|
+
var DefinePropertyOrThrow = require('es-abstract/2021/DefinePropertyOrThrow');
|
|
16
17
|
|
|
17
18
|
var $isProto = callBound('%Object.prototype.isPrototypeOf%');
|
|
18
19
|
|
|
@@ -66,6 +67,18 @@ test('throws', function (t) {
|
|
|
66
67
|
"Throws when middle part doesn't exist (%Proxy.prototype.undefined%)"
|
|
67
68
|
);
|
|
68
69
|
|
|
70
|
+
t['throws'](
|
|
71
|
+
function () { GetIntrinsic('%Array.prototype%garbage%'); },
|
|
72
|
+
SyntaxError,
|
|
73
|
+
'Throws with extra percent signs'
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
t['throws'](
|
|
77
|
+
function () { GetIntrinsic('%Array.prototype%push%'); },
|
|
78
|
+
SyntaxError,
|
|
79
|
+
'Throws with extra percent signs, even on an existing intrinsic'
|
|
80
|
+
);
|
|
81
|
+
|
|
69
82
|
forEach(v.nonStrings, function (nonString) {
|
|
70
83
|
t['throws'](
|
|
71
84
|
function () { GetIntrinsic(nonString); },
|
|
@@ -123,15 +136,15 @@ test('dotted paths', function (t) {
|
|
|
123
136
|
'%ObjProto_toString%',
|
|
124
137
|
'ObjProto_toString'
|
|
125
138
|
], function (name) {
|
|
126
|
-
|
|
127
|
-
|
|
139
|
+
DefinePropertyOrThrow(Object.prototype, 'toString', {
|
|
140
|
+
'[[Value]]': function toString() {
|
|
128
141
|
return original.apply(this, arguments);
|
|
129
142
|
}
|
|
130
143
|
});
|
|
131
144
|
st.equal(GetIntrinsic(name), original, name + ' yields original Object.prototype.toString');
|
|
132
145
|
});
|
|
133
146
|
|
|
134
|
-
|
|
147
|
+
DefinePropertyOrThrow(Object.prototype, 'toString', { '[[Value]]': original });
|
|
135
148
|
st.end();
|
|
136
149
|
});
|
|
137
150
|
|
|
@@ -144,15 +157,16 @@ test('dotted paths', function (t) {
|
|
|
144
157
|
'%ObjectPrototype.propertyIsEnumerable%',
|
|
145
158
|
'ObjectPrototype.propertyIsEnumerable'
|
|
146
159
|
], function (name) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
var restore = mockProperty(Object.prototype, 'propertyIsEnumerable', {
|
|
161
|
+
value: function propertyIsEnumerable() {
|
|
162
|
+
return original.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
151
165
|
st.equal(GetIntrinsic(name), original, name + ' yields cached Object.prototype.propertyIsEnumerable');
|
|
166
|
+
|
|
167
|
+
restore();
|
|
152
168
|
});
|
|
153
169
|
|
|
154
|
-
// eslint-disable-next-line no-extend-native
|
|
155
|
-
Object.prototype.propertyIsEnumerable = original;
|
|
156
170
|
st.end();
|
|
157
171
|
});
|
|
158
172
|
|
|
@@ -110,6 +110,8 @@ function setopts (self, pattern, options) {
|
|
|
110
110
|
// Note that they are not supported in Glob itself anyway.
|
|
111
111
|
options.nonegate = true
|
|
112
112
|
options.nocomment = true
|
|
113
|
+
// always treat \ in patterns as escapes, not path separators
|
|
114
|
+
options.allowWindowsEscape = false
|
|
113
115
|
|
|
114
116
|
self.minimatch = new Minimatch(pattern, options)
|
|
115
117
|
self.options = self.minimatch.options
|
|
@@ -342,7 +342,10 @@ Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
|
|
|
342
342
|
var read
|
|
343
343
|
if (prefix === null)
|
|
344
344
|
read = '.'
|
|
345
|
-
else if (isAbsolute(prefix) ||
|
|
345
|
+
else if (isAbsolute(prefix) ||
|
|
346
|
+
isAbsolute(pattern.map(function (p) {
|
|
347
|
+
return typeof p === 'string' ? p : '[*]'
|
|
348
|
+
}).join('/'))) {
|
|
346
349
|
if (!prefix || !isAbsolute(prefix))
|
|
347
350
|
prefix = '/' + prefix
|
|
348
351
|
read = prefix
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
3
3
|
"name": "glob",
|
|
4
4
|
"description": "a little globber",
|
|
5
|
-
"version": "7.2.
|
|
5
|
+
"version": "7.2.3",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"tag": "v7-legacy"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "git://github.com/isaacs/node-glob.git"
|
|
@@ -20,7 +23,7 @@
|
|
|
20
23
|
"fs.realpath": "^1.0.0",
|
|
21
24
|
"inflight": "^1.0.4",
|
|
22
25
|
"inherits": "2",
|
|
23
|
-
"minimatch": "^3.
|
|
26
|
+
"minimatch": "^3.1.1",
|
|
24
27
|
"once": "^1.3.0",
|
|
25
28
|
"path-is-absolute": "^1.0.0"
|
|
26
29
|
},
|
|
@@ -48,7 +48,7 @@ function GlobSync (pattern, options) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
GlobSync.prototype._finish = function () {
|
|
51
|
-
assert(this instanceof GlobSync)
|
|
51
|
+
assert.ok(this instanceof GlobSync)
|
|
52
52
|
if (this.realpath) {
|
|
53
53
|
var self = this
|
|
54
54
|
this.matches.forEach(function (matchset, index) {
|
|
@@ -72,7 +72,7 @@ GlobSync.prototype._finish = function () {
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
75
|
-
assert(this instanceof GlobSync)
|
|
75
|
+
assert.ok(this instanceof GlobSync)
|
|
76
76
|
|
|
77
77
|
// Get the first [n] parts of pattern that are all strings.
|
|
78
78
|
var n = 0
|
|
@@ -109,7 +109,10 @@ GlobSync.prototype._process = function (pattern, index, inGlobStar) {
|
|
|
109
109
|
var read
|
|
110
110
|
if (prefix === null)
|
|
111
111
|
read = '.'
|
|
112
|
-
else if (isAbsolute(prefix) ||
|
|
112
|
+
else if (isAbsolute(prefix) ||
|
|
113
|
+
isAbsolute(pattern.map(function (p) {
|
|
114
|
+
return typeof p === 'string' ? p : '[*]'
|
|
115
|
+
}).join('/'))) {
|
|
113
116
|
if (!prefix || !isAbsolute(prefix))
|
|
114
117
|
prefix = '/' + prefix
|
|
115
118
|
read = prefix
|
|
@@ -5,17 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
"rules": {
|
|
7
7
|
"id-length": 0,
|
|
8
|
-
"max-statements": [2, 14],
|
|
9
8
|
"max-statements-per-line": [2, { "max": 2 }],
|
|
10
|
-
"operator-linebreak": [2, "before"],
|
|
11
9
|
},
|
|
12
|
-
|
|
13
|
-
"overrides": [
|
|
14
|
-
{
|
|
15
|
-
"files": "test/**",
|
|
16
|
-
"rules": {
|
|
17
|
-
"no-throw-literal": 0,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
10
|
}
|
|
@@ -1,3 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [v1.2.7](https://github.com/inspect-js/is-callable/compare/v1.2.6...v1.2.7) - 2022-09-23
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Fix] recognize `document.all` in IE 6-10 [`06c1db2`](https://github.com/inspect-js/is-callable/commit/06c1db2b9b2e0f28428e1293eb572f8f93871ec7)
|
|
13
|
+
- [Tests] improve logic for FF 20-35 [`0f7d9b9`](https://github.com/inspect-js/is-callable/commit/0f7d9b9c7fe149ca87e71f0a125ade251a6a578c)
|
|
14
|
+
- [Fix] handle `document.all` in FF 27 (and +, probably) [`696c661`](https://github.com/inspect-js/is-callable/commit/696c661b8c0810c2d05ab172f1607f4e77ddf81e)
|
|
15
|
+
- [Tests] fix proxy tests in FF 42-63 [`985df0d`](https://github.com/inspect-js/is-callable/commit/985df0dd36f8cfe6f1993657b7c0f4cfc19dae30)
|
|
16
|
+
- [readme] update tested browsers [`389e919`](https://github.com/inspect-js/is-callable/commit/389e919493b1cb2010126b0411e5291bf76169bd)
|
|
17
|
+
- [Fix] detect `document.all` in Opera 12.16 [`b9f1022`](https://github.com/inspect-js/is-callable/commit/b9f1022b3d7e466b7f09080bd64c253caf644325)
|
|
18
|
+
- [Fix] HTML elements: properly report as callable in Opera 12.16 [`17391fe`](https://github.com/inspect-js/is-callable/commit/17391fe02b895777c4337be28dca3b364b743b34)
|
|
19
|
+
- [Tests] fix inverted logic in FF3 test [`056ebd4`](https://github.com/inspect-js/is-callable/commit/056ebd48790f46ca18ff5b12f51b44c08ccc3595)
|
|
20
|
+
|
|
21
|
+
## [v1.2.6](https://github.com/inspect-js/is-callable/compare/v1.2.5...v1.2.6) - 2022-09-14
|
|
22
|
+
|
|
23
|
+
### Commits
|
|
24
|
+
|
|
25
|
+
- [Fix] work for `document.all` in Firefox 3 and IE 6-8 [`015132a`](https://github.com/inspect-js/is-callable/commit/015132aaef886ec777b5b3593ef4ce461dd0c7d4)
|
|
26
|
+
- [Test] skip function toString check for nullish values [`8698116`](https://github.com/inspect-js/is-callable/commit/8698116f95eb59df8b48ec8e4585fc1cdd8cae9f)
|
|
27
|
+
- [readme] add "supported engines" section [`0442207`](https://github.com/inspect-js/is-callable/commit/0442207a89a1554d41ba36daf21862ef7ccbd500)
|
|
28
|
+
- [Tests] skip one of the fixture objects in FF 3.6 [`a501141`](https://github.com/inspect-js/is-callable/commit/a5011410bc6edb276c6ec8b47ce5c5d83c4bee15)
|
|
29
|
+
- [Tests] allow `class` constructor tests to fail in FF v45 - v54, which has undetectable classes [`b12e4a4`](https://github.com/inspect-js/is-callable/commit/b12e4a4d8c438678bd7710f9f896680150766b51)
|
|
30
|
+
- [Fix] Safari 4: regexes should not be considered callable [`4b732ff`](https://github.com/inspect-js/is-callable/commit/4b732ffa34346db3f0193ea4e46b7d4e637e6c82)
|
|
31
|
+
- [Fix] properly recognize `document.all` in Safari 4 [`3193735`](https://github.com/inspect-js/is-callable/commit/319373525dc4603346661641840cd9a3e0613136)
|
|
32
|
+
|
|
33
|
+
## [v1.2.5](https://github.com/inspect-js/is-callable/compare/v1.2.4...v1.2.5) - 2022-09-11
|
|
34
|
+
|
|
35
|
+
### Commits
|
|
36
|
+
|
|
37
|
+
- [actions] reuse common workflows [`5bb4b32`](https://github.com/inspect-js/is-callable/commit/5bb4b32dc93987328ab4f396601f751c4a7abd62)
|
|
38
|
+
- [meta] better `eccheck` command [`b9bd597`](https://github.com/inspect-js/is-callable/commit/b9bd597322b6e3a24c74c09881ca73e1d9f9f485)
|
|
39
|
+
- [meta] use `npmignore` to autogenerate an npmignore file [`3192d38`](https://github.com/inspect-js/is-callable/commit/3192d38527c7fc461d05d5aa93d47628e658bc45)
|
|
40
|
+
- [Fix] for HTML constructors, always use `tryFunctionObject` even in pre-toStringTag browsers [`3076ea2`](https://github.com/inspect-js/is-callable/commit/3076ea21d1f6ecc1cb711dcf1da08f257892c72b)
|
|
41
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `available-typed-arrays`, `object-inspect`, `safe-publish-latest`, `tape` [`8986746`](https://github.com/inspect-js/is-callable/commit/89867464c42adc5cd375ee074a4574b0295442cb)
|
|
42
|
+
- [meta] add `auto-changelog` [`7dda9d0`](https://github.com/inspect-js/is-callable/commit/7dda9d04e670a69ae566c8fa596da4ff4371e615)
|
|
43
|
+
- [Fix] properly report `document.all` [`da90b2b`](https://github.com/inspect-js/is-callable/commit/da90b2b68dc4f33702c2e01ad07b4f89bcb60984)
|
|
44
|
+
- [actions] update codecov uploader [`c8f847c`](https://github.com/inspect-js/is-callable/commit/c8f847c90e04e54ff73c7cfae86e96e94990e324)
|
|
45
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`899ae00`](https://github.com/inspect-js/is-callable/commit/899ae00b6abd10d81fc8bc7f02b345fd885d5f56)
|
|
46
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `es-value-fixtures`, `object-inspect`, `tape` [`344e913`](https://github.com/inspect-js/is-callable/commit/344e913b149609bf741aa7345fa32dc0b90d8893)
|
|
47
|
+
- [meta] remove greenkeeper config [`737dce5`](https://github.com/inspect-js/is-callable/commit/737dce5590b1abb16183a63cb9d7d26920b3b394)
|
|
48
|
+
- [meta] npmignore coverage output [`680a883`](https://github.com/inspect-js/is-callable/commit/680a8839071bf36a419fe66e1ced7a3303c27b28)
|
|
49
|
+
|
|
50
|
+
<!-- auto-changelog-above -->
|
|
1
51
|
1.2.4 / 2021-08-05
|
|
2
52
|
=================
|
|
3
53
|
* [Fix] use `has-tostringtag` approach to behave correctly in the presence of symbol shams
|
|
@@ -11,6 +11,22 @@
|
|
|
11
11
|
|
|
12
12
|
Is this JS value callable? Works with Functions and GeneratorFunctions, despite ES6 @@toStringTag.
|
|
13
13
|
|
|
14
|
+
## Supported engines
|
|
15
|
+
Automatically tested in every minor version of node.
|
|
16
|
+
|
|
17
|
+
Manually tested in:
|
|
18
|
+
- Safari: v4 - v15 <sub>(4, 5, 5.1, 6.0.5, 6.2, 7.1, 8, 9.1.3, 10.1.2, 11.1.2, 12.1, 13.1.2, 14.1.2, 15.3, 15.6.1)</sub>
|
|
19
|
+
- Note: Safari 9 has `class`, but `Function.prototype.toString` hides that progeny and makes them look like functions, so `class` constructors will be reported by this package as callable, when they are not in fact callable.
|
|
20
|
+
- Chrome: v15 - v81, v83 - v106<sub>(every integer version)</sub>
|
|
21
|
+
- Note: This includes Edge v80+ and Opera v15+, which matches Chrome
|
|
22
|
+
- Firefox: v3, v3.6, v4 - v105 <sub>(every integer version)</sub>
|
|
23
|
+
- Note: v45 - v54 has `class`, but `Function.prototype.toString` hides that progeny and makes them look like functions, so `class` constructors will be reported by this package as callable, when they are not in fact callable.
|
|
24
|
+
- Note: in v42 - v63, `Function.prototype.toString` throws on HTML element constructors, or a Proxy to a function
|
|
25
|
+
- Note: in v20 - v35, HTML element constructors are not callable, despite having typeof `function`.
|
|
26
|
+
- Note: in v19, `document.all` is not callable.
|
|
27
|
+
- IE: v6 - v11<sub>(every integer version</sub>
|
|
28
|
+
- Opera: v11.1, v11.5, v11.6, v12.1, v12.14, v12.15, v12.16, v15+ <sub>v15+ matches Chrome</sub>
|
|
29
|
+
|
|
14
30
|
## Example
|
|
15
31
|
|
|
16
32
|
```js
|
|
@@ -43,32 +43,59 @@ var tryFunctionObject = function tryFunctionToStr(value) {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
var toStr = Object.prototype.toString;
|
|
46
|
+
var objectClass = '[object Object]';
|
|
46
47
|
var fnClass = '[object Function]';
|
|
47
48
|
var genClass = '[object GeneratorFunction]';
|
|
49
|
+
var ddaClass = '[object HTMLAllCollection]'; // IE 11
|
|
50
|
+
var ddaClass2 = '[object HTML document.all class]';
|
|
51
|
+
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
|
|
48
52
|
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
|
|
49
|
-
|
|
50
|
-
var
|
|
53
|
+
|
|
54
|
+
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
|
|
55
|
+
|
|
56
|
+
var isDDA = function isDocumentDotAll() { return false; };
|
|
57
|
+
if (typeof document === 'object') {
|
|
58
|
+
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
|
|
59
|
+
var all = document.all;
|
|
60
|
+
if (toStr.call(all) === toStr.call(document.all)) {
|
|
61
|
+
isDDA = function isDocumentDotAll(value) {
|
|
62
|
+
/* globals document: false */
|
|
63
|
+
// in IE 6-8, typeof document.all is "object" and it's truthy
|
|
64
|
+
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
|
|
65
|
+
try {
|
|
66
|
+
var str = toStr.call(value);
|
|
67
|
+
return (
|
|
68
|
+
str === ddaClass
|
|
69
|
+
|| str === ddaClass2
|
|
70
|
+
|| str === ddaClass3 // opera 12.16
|
|
71
|
+
|| str === objectClass // IE 6-8
|
|
72
|
+
) && value('') == null; // eslint-disable-line eqeqeq
|
|
73
|
+
} catch (e) { /**/ }
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
51
79
|
|
|
52
80
|
module.exports = reflectApply
|
|
53
81
|
? function isCallable(value) {
|
|
54
|
-
if (value
|
|
82
|
+
if (isDDA(value)) { return true; }
|
|
55
83
|
if (!value) { return false; }
|
|
56
84
|
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
57
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
58
85
|
try {
|
|
59
86
|
reflectApply(value, null, badArrayLike);
|
|
60
87
|
} catch (e) {
|
|
61
88
|
if (e !== isCallableMarker) { return false; }
|
|
62
89
|
}
|
|
63
|
-
return !isES6ClassFn(value);
|
|
90
|
+
return !isES6ClassFn(value) && tryFunctionObject(value);
|
|
64
91
|
}
|
|
65
92
|
: function isCallable(value) {
|
|
66
|
-
if (value
|
|
93
|
+
if (isDDA(value)) { return true; }
|
|
67
94
|
if (!value) { return false; }
|
|
68
95
|
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
69
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
70
96
|
if (hasToStringTag) { return tryFunctionObject(value); }
|
|
71
97
|
if (isES6ClassFn(value)) { return false; }
|
|
72
98
|
var strClass = toStr.call(value);
|
|
73
|
-
|
|
99
|
+
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
|
|
100
|
+
return tryFunctionObject(value);
|
|
74
101
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is-callable",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Jordan Harband",
|
|
6
6
|
"email": "ljharb@gmail.com",
|
|
@@ -20,14 +20,17 @@
|
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"scripts": {
|
|
23
|
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
24
|
+
"version": "auto-changelog && git add CHANGELOG.md",
|
|
25
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
|
23
26
|
"prepublishOnly": "safe-publish-latest",
|
|
24
27
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
25
28
|
"pretest": "npm run --silent lint",
|
|
26
29
|
"test": "npm run tests-only --",
|
|
27
30
|
"posttest": "aud --production",
|
|
28
31
|
"tests-only": "nyc tape 'test/**/*.js'",
|
|
29
|
-
"prelint": "eclint check
|
|
30
|
-
"lint": "eslint ."
|
|
32
|
+
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
|
33
|
+
"lint": "eslint --ext=js,mjs ."
|
|
31
34
|
},
|
|
32
35
|
"repository": {
|
|
33
36
|
"type": "git",
|
|
@@ -46,22 +49,24 @@
|
|
|
46
49
|
"@@toStringTag"
|
|
47
50
|
],
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@ljharb/eslint-config": "^
|
|
50
|
-
"aud": "^
|
|
51
|
-
"
|
|
52
|
+
"@ljharb/eslint-config": "^21.0.0",
|
|
53
|
+
"aud": "^2.0.0",
|
|
54
|
+
"auto-changelog": "^2.4.0",
|
|
55
|
+
"available-typed-arrays": "^1.0.5",
|
|
52
56
|
"eclint": "^2.8.1",
|
|
53
|
-
"es-value-fixtures": "^1.2
|
|
54
|
-
"eslint": "
|
|
57
|
+
"es-value-fixtures": "^1.4.2",
|
|
58
|
+
"eslint": "=8.8.0",
|
|
55
59
|
"for-each": "^0.3.3",
|
|
56
60
|
"has-tostringtag": "^1.0.0",
|
|
57
61
|
"make-arrow-function": "^1.2.0",
|
|
58
62
|
"make-async-function": "^1.0.0",
|
|
59
63
|
"make-generator-function": "^2.0.0",
|
|
64
|
+
"npmignore": "^0.3.0",
|
|
60
65
|
"nyc": "^10.3.2",
|
|
61
|
-
"object-inspect": "^1.
|
|
66
|
+
"object-inspect": "^1.12.2",
|
|
62
67
|
"rimraf": "^2.7.1",
|
|
63
|
-
"safe-publish-latest": "^
|
|
64
|
-
"tape": "^5.
|
|
68
|
+
"safe-publish-latest": "^2.0.0",
|
|
69
|
+
"tape": "^5.6.0"
|
|
65
70
|
},
|
|
66
71
|
"testling": {
|
|
67
72
|
"files": "test/index.js",
|
|
@@ -84,9 +89,18 @@
|
|
|
84
89
|
"engines": {
|
|
85
90
|
"node": ">= 0.4"
|
|
86
91
|
},
|
|
87
|
-
"
|
|
92
|
+
"auto-changelog": {
|
|
93
|
+
"output": "CHANGELOG.md",
|
|
94
|
+
"template": "keepachangelog",
|
|
95
|
+
"unreleased": false,
|
|
96
|
+
"commitLimit": false,
|
|
97
|
+
"backfillLimit": false,
|
|
98
|
+
"hideCredit": true,
|
|
99
|
+
"startingVersion": "v1.2.5"
|
|
100
|
+
},
|
|
101
|
+
"publishConfig": {
|
|
88
102
|
"ignore": [
|
|
89
|
-
"
|
|
103
|
+
".github/workflows"
|
|
90
104
|
]
|
|
91
105
|
}
|
|
92
106
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/* globals Proxy */
|
|
4
3
|
/* eslint no-magic-numbers: 1 */
|
|
5
4
|
|
|
6
5
|
var test = require('tape');
|
|
@@ -20,6 +19,16 @@ try {
|
|
|
20
19
|
/* eslint-enable no-new-func */
|
|
21
20
|
} catch (e) { /**/ }
|
|
22
21
|
|
|
22
|
+
var isIE68 = !(0 in [undefined]);
|
|
23
|
+
var isFirefox = typeof window !== 'undefined' && ('netscape' in window) && (/ rv:/).test(navigator.userAgent);
|
|
24
|
+
var fnToStringCoerces;
|
|
25
|
+
try {
|
|
26
|
+
Function.prototype.toString.call(v.uncoercibleFnObject);
|
|
27
|
+
fnToStringCoerces = true;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
fnToStringCoerces = false;
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
var noop = function () {};
|
|
24
33
|
var classFake = function classFake() { }; // eslint-disable-line func-name-matching
|
|
25
34
|
var returnClass = function () { return ' class '; };
|
|
@@ -39,11 +48,8 @@ if (typeof Proxy === 'function') {
|
|
|
39
48
|
proxy();
|
|
40
49
|
String(proxy);
|
|
41
50
|
} catch (_) {
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
// Older engines throw a `TypeError` when `Function.prototype.toString` is called on a Proxy object.
|
|
45
|
-
proxy = null;
|
|
46
|
-
}
|
|
51
|
+
// Older engines throw a `TypeError` when `Function.prototype.toString` is called on a Proxy object.
|
|
52
|
+
proxy = null;
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -59,6 +65,7 @@ var invokeFunction = function invokeFunctionString(str) {
|
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
var classConstructor = invokeFunction('"use strict"; return class Foo {}');
|
|
68
|
+
var hasDetectableClasses = classConstructor && Function.prototype.toString.call(classConstructor) === 'class Foo {}';
|
|
62
69
|
|
|
63
70
|
var commentedClass = invokeFunction('"use strict"; return class/*kkk*/\n//blah\n Bar\n//blah\n {}');
|
|
64
71
|
var commentedClassOneLine = invokeFunction('"use strict"; return class/**/A{}');
|
|
@@ -77,6 +84,25 @@ test('not callables', function (t) {
|
|
|
77
84
|
new RegExp('a', 'g'),
|
|
78
85
|
new Date()
|
|
79
86
|
]), function (nonFunction) {
|
|
87
|
+
if (fnToStringCoerces && nonFunction === v.coercibleFnObject) {
|
|
88
|
+
t.comment('FF 3.6 has a Function toString that coerces its receiver, so this test is skipped');
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (nonFunction != null) { // eslint-disable-line eqeqeq
|
|
92
|
+
if (isFirefox) {
|
|
93
|
+
// Firefox 3 throws some kind of *object* here instead of a proper error
|
|
94
|
+
t['throws'](
|
|
95
|
+
function () { Function.prototype.toString.call(nonFunction); },
|
|
96
|
+
inspect(nonFunction) + ' can not be used with Function toString'
|
|
97
|
+
);
|
|
98
|
+
} else {
|
|
99
|
+
t['throws'](
|
|
100
|
+
function () { Function.prototype.toString.call(nonFunction); },
|
|
101
|
+
TypeError,
|
|
102
|
+
inspect(nonFunction) + ' can not be used with Function toString'
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
80
106
|
t.equal(isCallable(nonFunction), false, inspect(nonFunction) + ' is not callable');
|
|
81
107
|
});
|
|
82
108
|
|
|
@@ -133,7 +159,12 @@ test('Arrow functions', { skip: arrows.length === 0 }, function (t) {
|
|
|
133
159
|
t.end();
|
|
134
160
|
});
|
|
135
161
|
|
|
136
|
-
test('"Class" constructors', {
|
|
162
|
+
test('"Class" constructors', {
|
|
163
|
+
skip: !classConstructor || !commentedClass || !commentedClassOneLine || !classAnonymous, todo: !hasDetectableClasses
|
|
164
|
+
}, function (t) {
|
|
165
|
+
if (!hasDetectableClasses) {
|
|
166
|
+
t.comment('WARNING: This engine does not support detectable classes');
|
|
167
|
+
}
|
|
137
168
|
t.notOk(isCallable(classConstructor), 'class constructors are not callable');
|
|
138
169
|
t.notOk(isCallable(commentedClass), 'class constructors with comments in the signature are not callable');
|
|
139
170
|
t.notOk(isCallable(commentedClassOneLine), 'one-line class constructors with comments in the signature are not callable');
|
|
@@ -150,7 +181,7 @@ test('`async function`s', { skip: asyncs.length === 0 }, function (t) {
|
|
|
150
181
|
});
|
|
151
182
|
|
|
152
183
|
test('proxies of functions', { skip: !proxy }, function (t) {
|
|
153
|
-
t.
|
|
184
|
+
t.equal(isCallable(proxy), true, 'proxies of functions are callable');
|
|
154
185
|
t.end();
|
|
155
186
|
});
|
|
156
187
|
|
|
@@ -161,10 +192,53 @@ test('throwing functions', function (t) {
|
|
|
161
192
|
t.ok(isCallable(thrower), 'a function that throws is callable');
|
|
162
193
|
});
|
|
163
194
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
t.
|
|
195
|
+
test('DOM', function (t) {
|
|
196
|
+
/* eslint-env browser */
|
|
197
|
+
|
|
198
|
+
t.test('document.all', { skip: typeof document !== 'object' }, function (st) {
|
|
199
|
+
st.notOk(isCallable(document), 'document is not callable');
|
|
200
|
+
|
|
201
|
+
var all = document.all;
|
|
202
|
+
var isFF3 = !isIE68 && Object.prototype.toString(all) === Object.prototype.toString.call(document.all); // this test is true in IE 6-8 also
|
|
203
|
+
var expected = false;
|
|
204
|
+
if (!isFF3) {
|
|
205
|
+
try {
|
|
206
|
+
expected = document.all('') == null; // eslint-disable-line eqeqeq
|
|
207
|
+
} catch (e) { /**/ }
|
|
208
|
+
}
|
|
209
|
+
st.equal(isCallable(document.all), expected, 'document.all is ' + (isFF3 ? 'not ' : '') + 'callable');
|
|
210
|
+
|
|
211
|
+
st.end();
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
forEach([
|
|
215
|
+
'HTMLElement',
|
|
216
|
+
'HTMLAnchorElement'
|
|
217
|
+
], function (name) {
|
|
218
|
+
var constructor = global[name];
|
|
219
|
+
|
|
220
|
+
t.test(name, { skip: !constructor }, function (st) {
|
|
221
|
+
st.match(typeof constructor, /^(?:function|object)$/, name + ' is a function or object');
|
|
222
|
+
|
|
223
|
+
var callable = isCallable(constructor);
|
|
224
|
+
st.equal(typeof callable, 'boolean');
|
|
225
|
+
|
|
226
|
+
if (callable) {
|
|
227
|
+
st.doesNotThrow(
|
|
228
|
+
function () { Function.prototype.toString.call(constructor); },
|
|
229
|
+
'anything this library claims is callable should be accepted by Function toString'
|
|
230
|
+
);
|
|
231
|
+
} else {
|
|
232
|
+
st['throws'](
|
|
233
|
+
function () { Function.prototype.toString.call(constructor); },
|
|
234
|
+
TypeError,
|
|
235
|
+
'anything this library claims is not callable should not be accepted by Function toString'
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
st.end();
|
|
240
|
+
});
|
|
241
|
+
});
|
|
168
242
|
|
|
169
243
|
t.end();
|
|
170
244
|
});
|
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v2.10.0](https://github.com/inspect-js/is-core-module/compare/v2.9.0...v2.10.0) - 2022-08-03
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [New] `node:test` is now available in node ^16.17 [`e8fd36e`](https://github.com/inspect-js/is-core-module/commit/e8fd36e9b86c917775a07cc473b62a3294f459f2)
|
|
13
|
+
- [Tests] improve skip message [`c014a4c`](https://github.com/inspect-js/is-core-module/commit/c014a4c0cd6eb15fff573ae4709191775e70cab4)
|
|
14
|
+
|
|
8
15
|
## [v2.9.0](https://github.com/inspect-js/is-core-module/compare/v2.8.1...v2.9.0) - 2022-04-19
|
|
9
16
|
|
|
10
17
|
### Commits
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"node:string_decoder": [">= 14.18 && < 15", ">= 16"],
|
|
113
113
|
"sys": [">= 0.4 && < 0.7", ">= 0.8"],
|
|
114
114
|
"node:sys": [">= 14.18 && < 15", ">= 16"],
|
|
115
|
-
"node:test": ">= 18",
|
|
115
|
+
"node:test": [">= 16.17 && < 17", ">= 18"],
|
|
116
116
|
"timers": true,
|
|
117
117
|
"node:timers": [">= 14.18 && < 15", ">= 16"],
|
|
118
118
|
"timers/promises": ">= 15",
|