summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/callsites
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/callsites')
-rw-r--r--tools/node_modules/eslint/node_modules/callsites/index.d.ts73
-rw-r--r--tools/node_modules/eslint/node_modules/callsites/index.js14
-rw-r--r--tools/node_modules/eslint/node_modules/callsites/license9
-rw-r--r--tools/node_modules/eslint/node_modules/callsites/package.json21
-rw-r--r--tools/node_modules/eslint/node_modules/callsites/readme.md33
5 files changed, 120 insertions, 30 deletions
diff --git a/tools/node_modules/eslint/node_modules/callsites/index.d.ts b/tools/node_modules/eslint/node_modules/callsites/index.d.ts
new file mode 100644
index 0000000000..b5bb8f64d0
--- /dev/null
+++ b/tools/node_modules/eslint/node_modules/callsites/index.d.ts
@@ -0,0 +1,73 @@
+export interface CallSite {
+ /**
+ * Returns the value of `this`.
+ */
+ getThis(): unknown | undefined;
+
+ /**
+ * Returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property.
+ */
+ getTypeName(): string | null;
+
+ /**
+ * Returns the current function.
+ */
+ getFunction(): Function | undefined;
+
+ /**
+ * Returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
+ */
+ getFunctionName(): string | null;
+
+ /**
+ * Returns the name of the property of `this` or one of its prototypes that holds the current function.
+ */
+ getMethodName(): string | undefined;
+
+ /**
+ * Returns the name of the script if this function was defined in a script.
+ */
+ getFileName(): string | null;
+
+ /**
+ * Returns the current line number if this function was defined in a script.
+ */
+ getLineNumber(): number | null;
+
+ /**
+ * Returns the current column number if this function was defined in a script.
+ */
+ getColumnNumber(): number | null;
+
+ /**
+ * Returns a string representing the location where `eval` was called if this function was created using a call to `eval`.
+ */
+ getEvalOrigin(): string | undefined;
+
+ /**
+ * Returns `true` if this is a top-level invocation, that is, if it's a global object.
+ */
+ isToplevel(): boolean;
+
+ /**
+ * Returns `true` if this call takes place in code defined by a call to `eval`.
+ */
+ isEval(): boolean;
+
+ /**
+ * Returns `true` if this call is in native V8 code.
+ */
+ isNative(): boolean;
+
+ /**
+ * Returns `true` if this is a constructor call.
+ */
+ isConstructor(): boolean;
+}
+
+/**
+ * Get callsites from the V8 stack trace API.
+ *
+ * @returns An array of `CallSite` objects.
+ */
+export default function callsites(): CallSite[];
diff --git a/tools/node_modules/eslint/node_modules/callsites/index.js b/tools/node_modules/eslint/node_modules/callsites/index.js
index 098a2513a6..c408fc8091 100644
--- a/tools/node_modules/eslint/node_modules/callsites/index.js
+++ b/tools/node_modules/eslint/node_modules/callsites/index.js
@@ -1,8 +1,12 @@
'use strict';
-module.exports = function () {
- var _ = Error.prepareStackTrace;
- Error.prepareStackTrace = function (_, stack) { return stack };
- var stack = new Error().stack.slice(1);
- Error.prepareStackTrace = _;
+
+const callsites = () => {
+ const _prepareStackTrace = Error.prepareStackTrace;
+ Error.prepareStackTrace = (_, stack) => stack;
+ const stack = new Error().stack.slice(1);
+ Error.prepareStackTrace = _prepareStackTrace;
return stack;
};
+
+module.exports = callsites;
+module.exports.default = callsites;
diff --git a/tools/node_modules/eslint/node_modules/callsites/license b/tools/node_modules/eslint/node_modules/callsites/license
new file mode 100644
index 0000000000..e7af2f7710
--- /dev/null
+++ b/tools/node_modules/eslint/node_modules/callsites/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+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.
diff --git a/tools/node_modules/eslint/node_modules/callsites/package.json b/tools/node_modules/eslint/node_modules/callsites/package.json
index 4e9ac1d56f..d0b8df24d1 100644
--- a/tools/node_modules/eslint/node_modules/callsites/package.json
+++ b/tools/node_modules/eslint/node_modules/callsites/package.json
@@ -2,7 +2,7 @@
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
- "url": "http://sindresorhus.com"
+ "url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/callsites/issues"
@@ -11,20 +11,23 @@
"deprecated": false,
"description": "Get callsites from the V8 stack trace API",
"devDependencies": {
- "mocha": "*"
+ "ava": "^0.25.0",
+ "tsd-check": "^0.2.1",
+ "xo": "^0.23.0"
},
"engines": {
- "node": ">=0.10.0"
+ "node": ">=6"
},
"files": [
- "index.js"
+ "index.js",
+ "index.d.ts"
],
"homepage": "https://github.com/sindresorhus/callsites#readme",
"keywords": [
- "callsites",
- "callsite",
- "v8",
"stacktrace",
+ "v8",
+ "callsite",
+ "callsites",
"stack",
"trace",
"function",
@@ -39,7 +42,7 @@
"url": "git+https://github.com/sindresorhus/callsites.git"
},
"scripts": {
- "test": "mocha"
+ "test": "xo && ava && tsd-check"
},
- "version": "0.2.0"
+ "version": "3.0.0"
} \ No newline at end of file
diff --git a/tools/node_modules/eslint/node_modules/callsites/readme.md b/tools/node_modules/eslint/node_modules/callsites/readme.md
index 23aaca443a..fc846138f4 100644
--- a/tools/node_modules/eslint/node_modules/callsites/readme.md
+++ b/tools/node_modules/eslint/node_modules/callsites/readme.md
@@ -1,47 +1,48 @@
# callsites [![Build Status](https://travis-ci.org/sindresorhus/callsites.svg?branch=master)](https://travis-ci.org/sindresorhus/callsites)
-> Get callsites from the [V8 stack trace API](https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi)
+> Get callsites from the [V8 stack trace API](https://v8.dev/docs/stack-trace-api)
## Install
-```sh
-$ npm install --save callsites
+```
+$ npm install callsites
```
## Usage
```js
-var callsites = require('callsites');
+const callsites = require('callsites');
function unicorn() {
console.log(callsites()[0].getFileName());
- //=> /Users/sindresorhus/dev/callsites/test.js
+ //=> '/Users/sindresorhus/dev/callsites/test.js'
}
unicorn();
```
+
## API
Returns an array of callsite objects with the following methods:
-- `getThis`: returns the value of this
-- `getTypeName`: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.
-- `getFunction`: returns the current function
-- `getFunctionName`: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
-- `getMethodName`: returns the name of the property of this or one of its prototypes that holds the current function
-- `getFileName`: if this function was defined in a script returns the name of the script
-- `getLineNumber`: if this function was defined in a script returns the current line number
+- `getThis`: returns the value of `this`.
+- `getTypeName`: returns the type of `this` as a string. This is the name of the function stored in the constructor field of `this`, if available, otherwise the object's `[[Class]]` internal property.
+- `getFunction`: returns the current function.
+- `getFunctionName`: returns the name of the current function, typically its `name` property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
+- `getMethodName`: returns the name of the property of `this` or one of its prototypes that holds the current function.
+- `getFileName`: if this function was defined in a script returns the name of the script.
+- `getLineNumber`: if this function was defined in a script returns the current line number.
- `getColumnNumber`: if this function was defined in a script returns the current column number
-- `getEvalOrigin`: if this function was created using a call to eval returns a CallSite object representing the location where eval was called
-- `isToplevel`: is this a toplevel invocation, that is, is this the global object?
-- `isEval`: does this call take place in code defined by a call to eval?
+- `getEvalOrigin`: if this function was created using a call to `eval` returns a string representing the location where `eval` was called.
+- `isToplevel`: is this a top-level invocation, that is, is this the global object?
+- `isEval`: does this call take place in code defined by a call to `eval`?
- `isNative`: is this call in native V8 code?
- `isConstructor`: is this a constructor call?
## License
-MIT © [Sindre Sorhus](http://sindresorhus.com)
+MIT © [Sindre Sorhus](https://sindresorhus.com)