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

get-current-line

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-current-line - npm Package Compare versions

Comparing version 6.10.0 to 7.0.0-next.1700776114.96028b316c75a8ce4b85630695dd9195f7edce82

edition-es5/index.js

51

edition-browsers/index.js

@@ -37,3 +37,11 @@ /**

}
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
// Compatibility with Node.js versions <10
let frameRegexNamedGroups, frameRegexNumberedGroups;
try {
frameRegexNamedGroups =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
}
catch (error) {
frameRegexNumberedGroups = /\s+at\s(?:(.+?)\s\()?(.+?):(\d+):(\d+)\)?\s*$/;
}
/**

@@ -45,8 +53,8 @@ * Get the locations from a list of error stack frames.

const locations = [];
// Cycle through the lines
for (const frame of frames) {
// ensure each line is a string
const line = (frame || '').toString();
// skip empty lines
if (line.length === 0)
// Cycle through the frames
for (let frame of frames) {
// ensure each frame is a string
frame = (frame || '').toString();
// skip empty frames
if (frame.length === 0)
continue;

@@ -58,11 +66,24 @@ // Error

// at async Object.loadESM (internal/process/esm_loader.js:68:5)
const match = line.match(lineRegex);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
if (frameRegexNamedGroups) {
const match = frame.match(frameRegexNamedGroups);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
}
}
else {
const [match, method, file, line, char] = frame.match(frameRegexNumberedGroups) || [];
if (match) {
locations.push({
method: method || '',
file: file || '',
line: Number(line),
char: Number(char),
});
}
}
}

@@ -69,0 +90,0 @@ return locations;

@@ -85,4 +85,10 @@ /** The combination of location information about the line that was executing at the time */

const lineRegex =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/
// Compatibility with Node.js versions <10
let frameRegexNamedGroups: RegExp, frameRegexNumberedGroups: RegExp
try {
frameRegexNamedGroups =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/
} catch (error) {
frameRegexNumberedGroups = /\s+at\s(?:(.+?)\s\()?(.+?):(\d+):(\d+)\)?\s*$/
}

@@ -96,9 +102,9 @@ /**

// Cycle through the lines
for (const frame of frames) {
// ensure each line is a string
const line = (frame || '').toString()
// Cycle through the frames
for (let frame of frames) {
// ensure each frame is a string
frame = (frame || '').toString()
// skip empty lines
if (line.length === 0) continue
// skip empty frames
if (frame.length === 0) continue

@@ -110,10 +116,23 @@ // Error

// at async Object.loadESM (internal/process/esm_loader.js:68:5)
const match = line.match(lineRegex)
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
})
if (frameRegexNamedGroups) {
const match = frame.match(frameRegexNamedGroups)
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
})
}
} else {
const [match, method, file, line, char] =
frame.match(frameRegexNumberedGroups) || []
if (match) {
locations.push({
method: method || '',
file: file || '',
line: Number(line),
char: Number(char),
})
}
}

@@ -120,0 +139,0 @@ }

@@ -37,3 +37,11 @@ /**

}
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
// Compatibility with Node.js versions <10
let frameRegexNamedGroups, frameRegexNumberedGroups;
try {
frameRegexNamedGroups =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
}
catch (error) {
frameRegexNumberedGroups = /\s+at\s(?:(.+?)\s\()?(.+?):(\d+):(\d+)\)?\s*$/;
}
/**

@@ -45,8 +53,8 @@ * Get the locations from a list of error stack frames.

const locations = [];
// Cycle through the lines
for (const frame of frames) {
// ensure each line is a string
const line = (frame || '').toString();
// skip empty lines
if (line.length === 0)
// Cycle through the frames
for (let frame of frames) {
// ensure each frame is a string
frame = (frame || '').toString();
// skip empty frames
if (frame.length === 0)
continue;

@@ -58,11 +66,24 @@ // Error

// at async Object.loadESM (internal/process/esm_loader.js:68:5)
const match = line.match(lineRegex);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
if (frameRegexNamedGroups) {
const match = frame.match(frameRegexNamedGroups);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
}
}
else {
const [match, method, file, line, char] = frame.match(frameRegexNumberedGroups) || [];
if (match) {
locations.push({
method: method || '',
file: file || '',
line: Number(line),
char: Number(char),
});
}
}
}

@@ -69,0 +90,0 @@ return locations;

@@ -41,3 +41,11 @@ "use strict";

exports.getFramesFromError = getFramesFromError;
const lineRegex = /\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
// Compatibility with Node.js versions <10
let frameRegexNamedGroups, frameRegexNumberedGroups;
try {
frameRegexNamedGroups =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/;
}
catch (error) {
frameRegexNumberedGroups = /\s+at\s(?:(.+?)\s\()?(.+?):(\d+):(\d+)\)?\s*$/;
}
/**

@@ -49,8 +57,8 @@ * Get the locations from a list of error stack frames.

const locations = [];
// Cycle through the lines
for (const frame of frames) {
// ensure each line is a string
const line = (frame || '').toString();
// skip empty lines
if (line.length === 0)
// Cycle through the frames
for (let frame of frames) {
// ensure each frame is a string
frame = (frame || '').toString();
// skip empty frames
if (frame.length === 0)
continue;

@@ -62,11 +70,24 @@ // Error

// at async Object.loadESM (internal/process/esm_loader.js:68:5)
const match = line.match(lineRegex);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
if (frameRegexNamedGroups) {
const match = frame.match(frameRegexNamedGroups);
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
});
}
}
else {
const [match, method, file, line, char] = frame.match(frameRegexNumberedGroups) || [];
if (match) {
locations.push({
method: method || '',
file: file || '',
line: Number(line),
char: Number(char),
});
}
}
}

@@ -73,0 +94,0 @@ return locations;

{
"name": "get-current-line",
"version": "6.10.0",
"version": "7.0.0-next.1700776114.96028b316c75a8ce4b85630695dd9195f7edce82",
"description": "Get the current line number of the executing file and method",

@@ -16,2 +16,3 @@ "homepage": "https://github.com/bevry/get-current-line",

"es2022",
"es5",
"export-default",

@@ -88,3 +89,3 @@ "file",

"engines": {
"node": ">=10"
"node": ">=4"
},

@@ -118,3 +119,3 @@ "editions": [

{
"description": "TypeScript compiled against ES2022 for Node.js 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules",
"description": "TypeScript compiled against ES2022 for Node.js 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules",
"directory": "edition-es2022",

@@ -129,3 +130,3 @@ "entry": "index.js",

"engines": {
"node": "10 || 12 || 14 || 16 || 18 || 20 || 21",
"node": "6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21",
"browsers": false

@@ -135,2 +136,17 @@ }

{
"description": "TypeScript compiled against ES5 for Node.js 4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules",
"directory": "edition-es5",
"entry": "index.js",
"tags": [
"compiled",
"javascript",
"es5",
"require"
],
"engines": {
"node": "4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21",
"browsers": false
}
},
{
"description": "TypeScript compiled against ES2022 for Node.js 12 || 14 || 16 || 18 || 20 || 21 with Import for modules",

@@ -178,3 +194,3 @@ "directory": "edition-es2022-esm",

"type": "module",
"main": "edition-es2022/index.js",
"main": "index.cjs",
"exports": {

@@ -184,2 +200,3 @@ "node": {

"import": "./edition-es2022-esm/index.js",
"default": "./index.cjs",
"require": "./edition-es2022/index.js"

@@ -195,5 +212,8 @@ },

"module": "edition-browsers/index.js",
"dependencies": {
"editions": "^6.15.0"
},
"devDependencies": {
"@bevry/update-contributors": "^1.23.0",
"@types/node": "^20.9.3",
"@types/node": "^20.9.5",
"@typescript-eslint/eslint-plugin": "^6.12.0",

@@ -203,3 +223,3 @@ "@typescript-eslint/parser": "^6.12.0",

"eslint": "^8.54.0",
"eslint-config-bevry": "^5.0.0",
"eslint-config-bevry": "^5.1.0",
"eslint-config-prettier": "^9.0.0",

@@ -210,12 +230,12 @@ "eslint-plugin-prettier": "^5.0.1",

"prettier": "^3.1.0",
"projectz": "^3.2.0",
"projectz": "^3.3.0",
"surge": "^0.23.1",
"typedoc": "^0.25.3",
"typescript": "5.2.2",
"valid-directory": "^4.4.0",
"valid-module": "^2.4.0"
"valid-directory": "^4.5.0",
"valid-module": "^2.5.0"
},
"scripts": {
"our:clean": "rm -rf ./docs ./edition* ./es2015 ./es5 ./out ./.next",
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-es2022 && npm run our:compile:edition-es2022-esm && npm run our:compile:edition-types",
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-browsers && npm run our:compile:edition-es2022 && npm run our:compile:edition-es2022-esm && npm run our:compile:edition-es5 && npm run our:compile:edition-types",
"our:compile:deno": "make-deno-edition --attempt",

@@ -225,2 +245,3 @@ "our:compile:edition-browsers": "tsc --module ESNext --target ES2022 --outDir ./edition-browsers --project tsconfig.json && ( test ! -d edition-browsers/source || ( mv edition-browsers/source edition-temp && rm -rf edition-browsers && mv edition-temp edition-browsers ) )",

"our:compile:edition-es2022-esm": "tsc --module ESNext --target ES2022 --outDir ./edition-es2022-esm --project tsconfig.json && ( test ! -d edition-es2022-esm/source || ( mv edition-es2022-esm/source edition-temp && rm -rf edition-es2022-esm && mv edition-temp edition-es2022-esm ) ) && printf '%s' '{\"type\": \"module\"}' > edition-es2022-esm/package.json",
"our:compile:edition-es5": "tsc --module commonjs --target ES5 --outDir ./edition-es5 --project tsconfig.json && ( test ! -d edition-es5/source || ( mv edition-es5/source edition-temp && rm -rf edition-es5 && mv edition-temp edition-es5 ) ) && printf '%s' '{\"type\": \"commonjs\"}' > edition-es5/package.json",
"our:compile:edition-types": "tsc --emitDeclarationOnly --declaration --declarationMap --declarationDir ./edition-types --project tsconfig.json && ( test ! -d edition-types/source || ( mv edition-types/source edition-temp && rm -rf edition-types && mv edition-temp edition-types ) )",

@@ -247,3 +268,3 @@ "our:deploy": "printf '%s\n' 'no need for this project'",

"our:verify:prettier": "prettier --write .",
"test": "node ./edition-es2022/test.js"
"test": "node ./test.cjs"
},

@@ -260,2 +281,2 @@ "eslintConfig": {

}
}
}

@@ -71,3 +71,3 @@ <!-- TITLE/ -->

``` typescript
import pkg from 'https://unpkg.com/get-current-line@^6.10.0/edition-deno/index.ts'
import pkg from 'https://unpkg.com/get-current-line@^7.0.0/edition-deno/index.ts'
```

@@ -79,3 +79,3 @@

<script type="module">
import pkg from '//cdn.skypack.dev/get-current-line@^6.10.0'
import pkg from '//cdn.skypack.dev/get-current-line@^7.0.0'
</script>

@@ -88,3 +88,3 @@ ```

<script type="module">
import pkg from '//unpkg.com/get-current-line@^6.10.0'
import pkg from '//unpkg.com/get-current-line@^7.0.0'
</script>

@@ -97,3 +97,3 @@ ```

<script type="module">
import pkg from '//dev.jspm.io/get-current-line@6.10.0'
import pkg from '//dev.jspm.io/get-current-line@7.0.0'
</script>

@@ -106,6 +106,7 @@ ```

<ul><li><code>get-current-line/source/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<ul><li><code>get-current-line</code> aliases <code>get-current-line/index.cjs</code> which uses the <a href="https://github.com/bevry/editions" title="You can use the Editions Autoloader to autoload the appropriate edition for your consumers environment">Editions Autoloader</a> to automatically select the correct edition for the consumer's environment</li>
<li><code>get-current-line/source/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<li><code>get-current-line/edition-browsers/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for web browsers with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>
<li><code>get-current-line</code> aliases <code>get-current-line/edition-es2022/index.js</code></li>
<li><code>get-current-line/edition-es2022/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 10 || 12 || 14 || 16 || 18 || 20 || 21 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>get-current-line/edition-es2022/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>get-current-line/edition-es5/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES5 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li>
<li><code>get-current-line/edition-es2022-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 12 || 14 || 16 || 18 || 20 || 21 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>

@@ -112,0 +113,0 @@ <li><code>get-current-line/edition-types/index.d.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled Types with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li>

@@ -85,4 +85,10 @@ /** The combination of location information about the line that was executing at the time */

const lineRegex =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/
// Compatibility with Node.js versions <10
let frameRegexNamedGroups: RegExp, frameRegexNumberedGroups: RegExp
try {
frameRegexNamedGroups =
/\s+at\s(?:(?<method>.+?)\s\()?(?<file>.+?):(?<line>\d+):(?<char>\d+)\)?\s*$/
} catch (error) {
frameRegexNumberedGroups = /\s+at\s(?:(.+?)\s\()?(.+?):(\d+):(\d+)\)?\s*$/
}

@@ -96,9 +102,9 @@ /**

// Cycle through the lines
for (const frame of frames) {
// ensure each line is a string
const line = (frame || '').toString()
// Cycle through the frames
for (let frame of frames) {
// ensure each frame is a string
frame = (frame || '').toString()
// skip empty lines
if (line.length === 0) continue
// skip empty frames
if (frame.length === 0) continue

@@ -110,10 +116,23 @@ // Error

// at async Object.loadESM (internal/process/esm_loader.js:68:5)
const match = line.match(lineRegex)
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
})
if (frameRegexNamedGroups) {
const match = frame.match(frameRegexNamedGroups)
if (match && match.groups) {
locations.push({
method: match.groups.method || '',
file: match.groups.file || '',
line: Number(match.groups.line),
char: Number(match.groups.char),
})
}
} else {
const [match, method, file, line, char] =
frame.match(frameRegexNumberedGroups) || []
if (match) {
locations.push({
method: method || '',
file: file || '',
line: Number(line),
char: Number(char),
})
}
}

@@ -120,0 +139,0 @@ }

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